<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Doxygen: surface/include/pcl/surface/3rdparty/opennurbs/zlib.h 源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Doxygen
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'搜索','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','搜索');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('zlib_8h_source.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">zlib.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/* zlib.h -- interface of the &#39;zlib&#39; general purpose compression library</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment">  version 1.2.3, July 18th, 2005</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment">  Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment">  This software is provided &#39;as-is&#39;, without any express or implied</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment">  warranty.  In no event will the authors be held liable for any damages</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment">  arising from the use of this software.</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment">  Permission is granted to anyone to use this software for any purpose,</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment">  including commercial applications, and to alter it and redistribute it</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment">  freely, subject to the following restrictions:</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment">  1. The origin of this software must not be misrepresented; you must not</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment">     claim that you wrote the original software. If you use this software</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment">     in a product, an acknowledgment in the product documentation would be</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment">     appreciated but is not required.</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment">  2. Altered source versions must be plainly marked as such, and must not be</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment">     misrepresented as being the original software.</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment">  3. This notice may not be removed or altered from any source distribution.</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment">  Jean-loup Gailly        Mark Adler</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment">  jloup@gzip.org          madler@alumni.caltech.edu</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="comment">  The data format used by the zlib library is described by RFCs (Request for</span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="comment">  Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt</span></div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="comment">  (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).</span></div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160; </div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="preprocessor">#ifndef ZLIB_H</span></div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="preprocessor">#define ZLIB_H</span></div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160; </div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="preprocessor">#include &quot;zconf.h&quot;</span></div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160; </div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="preprocessor">#ifdef __cplusplus</span></div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160; </div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="preprocessor">#define ZLIB_VERSION &quot;1.2.3&quot;</span></div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="preprocessor">#define ZLIB_VERNUM 0x1230</span></div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160; </div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;<span class="comment">     The &#39;zlib&#39; compression library provides in-memory compression and</span></div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;<span class="comment">  decompression functions, including integrity checks of the uncompressed</span></div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;<span class="comment">  data.  This version of the library supports only one compression method</span></div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;<span class="comment">  (deflation) but other algorithms will be added later and will have the same</span></div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;<span class="comment">  stream interface.</span></div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;<span class="comment">     Compression can be done in a single step if the buffers are large</span></div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;<span class="comment">  enough (for example if an input file is mmap&#39;ed), or can be done by</span></div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;<span class="comment">  repeated calls of the compression function.  In the latter case, the</span></div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;<span class="comment">  application must provide more input and/or consume the output</span></div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="comment">  (providing more output space) before each call.</span></div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;<span class="comment">     The compressed data format used by default by the in-memory functions is</span></div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;<span class="comment">  the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped</span></div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;<span class="comment">  around a deflate stream, which is itself documented in RFC 1951.</span></div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;<span class="comment">     The library also supports reading and writing files in gzip (.gz) format</span></div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;<span class="comment">  with an interface similar to that of stdio using the functions that start</span></div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;<span class="comment">  with &quot;gz&quot;.  The gzip format is different from the zlib format.  gzip is a</span></div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;<span class="comment">  gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.</span></div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;<span class="comment">     This library can optionally read and write gzip streams in memory as well.</span></div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;<span class="comment">     The zlib format was designed to be compact and fast for use in memory</span></div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;<span class="comment">  and on communications channels.  The gzip format was designed for single-</span></div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;<span class="comment">  file compression on file systems, has a larger header than zlib to maintain</span></div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;<span class="comment">  directory information, and uses a different, slower check method than zlib.</span></div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;<span class="comment">     The library does not install any signal handler. The decoder checks</span></div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;<span class="comment">  the consistency of the compressed data, so the library should never</span></div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;<span class="comment">  crash even in case of corrupted input.</span></div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160; </div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;<span class="keyword">typedef</span> voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;<span class="keyword">typedef</span> void   (*free_func)  OF((voidpf opaque, voidpf address));</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160; </div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;<span class="keyword">struct </span><a class="code" href="structinternal__state.html">internal_state</a>;</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160; </div>
<div class="line"><a name="l00082"></a><span class="lineno"><a class="line" href="structz__stream__s.html">   82</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structz__stream__s.html">z_stream_s</a> {</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;    Bytef    *next_in;  <span class="comment">/* next input byte */</span></div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;    uInt     avail_in;  <span class="comment">/* number of bytes available at next_in */</span></div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;    uLong    total_in;  <span class="comment">/* total nb of input bytes read so far */</span></div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160; </div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;    Bytef    *next_out; <span class="comment">/* next output byte should be put there */</span></div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;    uInt     avail_out; <span class="comment">/* remaining free space at next_out */</span></div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;    uLong    total_out; <span class="comment">/* total nb of bytes output so far */</span></div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160; </div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;    <span class="keywordtype">char</span>     *msg;      <span class="comment">/* last error message, NULL if no error */</span></div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    <span class="keyword">struct </span><a class="code" href="structinternal__state.html">internal_state</a> FAR *state; <span class="comment">/* not visible by applications */</span></div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160; </div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;    alloc_func zalloc;  <span class="comment">/* used to allocate the internal state */</span></div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;    free_func  zfree;   <span class="comment">/* used to free the internal state */</span></div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;    voidpf     opaque;  <span class="comment">/* private data object passed to zalloc and zfree */</span></div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160; </div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;    <span class="keywordtype">int</span>     data_type;  <span class="comment">/* best guess about the data type: binary or text */</span></div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;    uLong   adler;      <span class="comment">/* adler32 value of the uncompressed data */</span></div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;    uLong   reserved;   <span class="comment">/* reserved for future use */</span></div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;} <a class="code" href="structz__stream__s.html">z_stream</a>;</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160; </div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;<span class="keyword">typedef</span> <a class="code" href="structz__stream__s.html">z_stream</a> FAR *z_streamp;</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160; </div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;<span class="comment">     gzip header information passed to and from zlib routines.  See RFC 1952</span></div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;<span class="comment">  for more details on the meanings of these fields.</span></div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00109"></a><span class="lineno"><a class="line" href="structgz__header__s.html">  109</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structgz__header__s.html">gz_header_s</a> {</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;    <span class="keywordtype">int</span>     text;       <span class="comment">/* true if compressed data believed to be text */</span></div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;    uLong   time;       <span class="comment">/* modification time */</span></div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;    <span class="keywordtype">int</span>     xflags;     <span class="comment">/* extra flags (not used when writing a gzip file) */</span></div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;    <span class="keywordtype">int</span>     os;         <span class="comment">/* operating system */</span></div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;    Bytef   *extra;     <span class="comment">/* pointer to extra field or Z_NULL if none */</span></div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;    uInt    extra_len;  <span class="comment">/* extra field length (valid if extra != Z_NULL) */</span></div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;    uInt    extra_max;  <span class="comment">/* space at extra (only when reading header) */</span></div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;    Bytef   *name;      <span class="comment">/* pointer to zero-terminated file name or Z_NULL */</span></div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;    uInt    name_max;   <span class="comment">/* space at name (only when reading header) */</span></div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;    Bytef   *comment;   <span class="comment">/* pointer to zero-terminated comment or Z_NULL */</span></div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;    uInt    comm_max;   <span class="comment">/* space at comment (only when reading header) */</span></div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;    <span class="keywordtype">int</span>     hcrc;       <span class="comment">/* true if there was or will be a header crc */</span></div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;    <span class="keywordtype">int</span>     done;       <span class="comment">/* true when done reading gzip header (not used</span></div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;<span class="comment">                           when writing a gzip file) */</span></div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;} <a class="code" href="structgz__header__s.html">gz_header</a>;</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160; </div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;<span class="keyword">typedef</span> <a class="code" href="structgz__header__s.html">gz_header</a> FAR *gz_headerp;</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160; </div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;<span class="comment">   The application must update next_in and avail_in when avail_in has</span></div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;<span class="comment">   dropped to zero. It must update next_out and avail_out when avail_out</span></div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;<span class="comment">   has dropped to zero. The application must initialize zalloc, zfree and</span></div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;<span class="comment">   opaque before calling the init function. All other fields are set by the</span></div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;<span class="comment">   compression library and must not be updated by the application.</span></div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;<span class="comment">   The opaque value provided by the application will be passed as the first</span></div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;<span class="comment">   parameter for calls of zalloc and zfree. This can be useful for custom</span></div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;<span class="comment">   memory management. The compression library attaches no meaning to the</span></div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;<span class="comment">   opaque value.</span></div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;<span class="comment">   zalloc must return Z_NULL if there is not enough memory for the object.</span></div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;<span class="comment">   If zlib is used in a multi-threaded application, zalloc and zfree must be</span></div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;<span class="comment">   thread safe.</span></div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;<span class="comment">   On 16-bit systems, the functions zalloc and zfree must be able to allocate</span></div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;<span class="comment">   exactly 65536 bytes, but will not be required to allocate more than this</span></div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;<span class="comment">   if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,</span></div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;<span class="comment">   pointers returned by zalloc for objects of exactly 65536 bytes *must*</span></div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;<span class="comment">   have their offset normalized to zero. The default allocation function</span></div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;<span class="comment">   provided by this library ensures this (see zutil.c). To reduce memory</span></div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;<span class="comment">   requirements and avoid any allocation of 64K objects, at the expense of</span></div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;<span class="comment">   compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).</span></div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;<span class="comment">   The fields total_in and total_out can be used for statistics or</span></div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;<span class="comment">   progress reports. After compression, total_in holds the total size of</span></div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;<span class="comment">   the uncompressed data and may be saved for use in the decompressor</span></div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;<span class="comment">   (particularly if the decompressor wants to decompress everything in</span></div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;<span class="comment">   a single step).</span></div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160; </div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;                        <span class="comment">/* constants */</span></div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160; </div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;<span class="preprocessor">#define Z_NO_FLUSH      0</span></div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;<span class="preprocessor">#define Z_PARTIAL_FLUSH 1 </span><span class="comment">/* will be removed, use Z_SYNC_FLUSH instead */</span><span class="preprocessor"></span></div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;<span class="preprocessor">#define Z_SYNC_FLUSH    2</span></div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;<span class="preprocessor">#define Z_FULL_FLUSH    3</span></div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;<span class="preprocessor">#define Z_FINISH        4</span></div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;<span class="preprocessor">#define Z_BLOCK         5</span></div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;<span class="comment">/* Allowed flush values; see deflate() and inflate() below for details */</span></div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160; </div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;<span class="preprocessor">#define Z_OK            0</span></div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;<span class="preprocessor">#define Z_STREAM_END    1</span></div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;<span class="preprocessor">#define Z_NEED_DICT     2</span></div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;<span class="preprocessor">#define Z_ERRNO        (-1)</span></div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;<span class="preprocessor">#define Z_STREAM_ERROR (-2)</span></div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;<span class="preprocessor">#define Z_DATA_ERROR   (-3)</span></div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;<span class="preprocessor">#define Z_MEM_ERROR    (-4)</span></div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;<span class="preprocessor">#define Z_BUF_ERROR    (-5)</span></div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;<span class="preprocessor">#define Z_VERSION_ERROR (-6)</span></div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;<span class="comment">/* Return codes for the compression/decompression functions. Negative</span></div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;<span class="comment"> * values are errors, positive values are used for special but normal events.</span></div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160; </div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;<span class="preprocessor">#define Z_NO_COMPRESSION         0</span></div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;<span class="preprocessor">#define Z_BEST_SPEED             1</span></div>
<div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;<span class="preprocessor">#define Z_BEST_COMPRESSION       9</span></div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;<span class="preprocessor">#define Z_DEFAULT_COMPRESSION  (-1)</span></div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;<span class="comment">/* compression levels */</span></div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160; </div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;<span class="preprocessor">#define Z_FILTERED            1</span></div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;<span class="preprocessor">#define Z_HUFFMAN_ONLY        2</span></div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;<span class="preprocessor">#define Z_RLE                 3</span></div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;<span class="preprocessor">#define Z_FIXED               4</span></div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;<span class="preprocessor">#define Z_DEFAULT_STRATEGY    0</span></div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;<span class="comment">/* compression strategy; see deflateInit2() below for details */</span></div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160; </div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;<span class="preprocessor">#define Z_BINARY   0</span></div>
<div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;<span class="preprocessor">#define Z_TEXT     1</span></div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;<span class="preprocessor">#define Z_ASCII    Z_TEXT   </span><span class="comment">/* for compatibility with 1.2.2 and earlier */</span><span class="preprocessor"></span></div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;<span class="preprocessor">#define Z_UNKNOWN  2</span></div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;<span class="comment">/* Possible values of the data_type field (though see inflate()) */</span></div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160; </div>
<div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;<span class="preprocessor">#define Z_DEFLATED   8</span></div>
<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;<span class="comment">/* The deflate compression method (the only one supported in this version) */</span></div>
<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160; </div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;<span class="preprocessor">#define Z_NULL  0  </span><span class="comment">/* for initializing zalloc, zfree, opaque */</span><span class="preprocessor"></span></div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160; </div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;<span class="preprocessor">#define zlib_version zlibVersion()</span></div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;<span class="comment">/* for compatibility with versions &lt; 1.0.2 */</span></div>
<div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160; </div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;                        <span class="comment">/* basic functions */</span></div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160; </div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;ZEXTERN <span class="keyword">const</span> <span class="keywordtype">char</span> * ZEXPORT zlibVersion OF((<span class="keywordtype">void</span>));</div>
<div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;<span class="comment">/* The application can compare zlibVersion and ZLIB_VERSION for consistency.</span></div>
<div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;<span class="comment">   If the first character differs, the library code actually used is</span></div>
<div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;<span class="comment">   not compatible with the zlib.h header file used by the application.</span></div>
<div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;<span class="comment">   This check is automatically made by deflateInit and inflateInit.</span></div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160; </div>
<div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;<span class="comment">ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));</span></div>
<div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;<span class="comment">     Initializes the internal stream state for compression. The fields</span></div>
<div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;<span class="comment">   zalloc, zfree and opaque must be initialized before by the caller.</span></div>
<div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;<span class="comment">   If zalloc and zfree are set to Z_NULL, deflateInit updates them to</span></div>
<div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;<span class="comment">   use default allocation functions.</span></div>
<div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;<span class="comment">     The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:</span></div>
<div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;<span class="comment">   1 gives best speed, 9 gives best compression, 0 gives no compression at</span></div>
<div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;<span class="comment">   all (the input data is simply copied a block at a time).</span></div>
<div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;<span class="comment">   Z_DEFAULT_COMPRESSION requests a default compromise between speed and</span></div>
<div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;<span class="comment">   compression (currently equivalent to level 6).</span></div>
<div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;<span class="comment">     deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not</span></div>
<div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;<span class="comment">   enough memory, Z_STREAM_ERROR if level is not a valid compression level,</span></div>
<div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;<span class="comment">   Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible</span></div>
<div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;<span class="comment">   with the version assumed by the caller (ZLIB_VERSION).</span></div>
<div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;<span class="comment">   msg is set to null if there is no error message.  deflateInit does not</span></div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;<span class="comment">   perform any compression: this will be done by deflate().</span></div>
<div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160; </div>
<div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160; </div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT deflate OF((z_streamp strm, <span class="keywordtype">int</span> flush));</div>
<div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160;<span class="comment">    deflate compresses as much data as possible, and stops when the input</span></div>
<div class="line"><a name="l00245"></a><span class="lineno">  245</span>&#160;<span class="comment">  buffer becomes empty or the output buffer becomes full. It may introduce some</span></div>
<div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;<span class="comment">  output latency (reading input without producing any output) except when</span></div>
<div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;<span class="comment">  forced to flush.</span></div>
<div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;<span class="comment">    The detailed semantics are as follows. deflate performs one or both of the</span></div>
<div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;<span class="comment">  following actions:</span></div>
<div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;<span class="comment">  - Compress more input starting at next_in and update next_in and avail_in</span></div>
<div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;<span class="comment">    accordingly. If not all input can be processed (because there is not</span></div>
<div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;<span class="comment">    enough room in the output buffer), next_in and avail_in are updated and</span></div>
<div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;<span class="comment">    processing will resume at this point for the next call of deflate().</span></div>
<div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160;<span class="comment">  - Provide more output starting at next_out and update next_out and avail_out</span></div>
<div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;<span class="comment">    accordingly. This action is forced if the parameter flush is non zero.</span></div>
<div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;<span class="comment">    Forcing flush frequently degrades the compression ratio, so this parameter</span></div>
<div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;<span class="comment">    should be set only when necessary (in interactive applications).</span></div>
<div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;<span class="comment">    Some output may be provided even if flush is not set.</span></div>
<div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;<span class="comment">  Before the call of deflate(), the application should ensure that at least</span></div>
<div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;<span class="comment">  one of the actions is possible, by providing more input and/or consuming</span></div>
<div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;<span class="comment">  more output, and updating avail_in or avail_out accordingly; avail_out</span></div>
<div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;<span class="comment">  should never be zero before the call. The application can consume the</span></div>
<div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;<span class="comment">  compressed output when it wants, for example when the output buffer is full</span></div>
<div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;<span class="comment">  (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK</span></div>
<div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;<span class="comment">  and with zero avail_out, it must be called again after making room in the</span></div>
<div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160;<span class="comment">  output buffer because there might be more output pending.</span></div>
<div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00272"></a><span class="lineno">  272</span>&#160;<span class="comment">    Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to</span></div>
<div class="line"><a name="l00273"></a><span class="lineno">  273</span>&#160;<span class="comment">  decide how much data to accumualte before producing output, in order to</span></div>
<div class="line"><a name="l00274"></a><span class="lineno">  274</span>&#160;<span class="comment">  maximize compression.</span></div>
<div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00276"></a><span class="lineno">  276</span>&#160;<span class="comment">    If the parameter flush is set to Z_SYNC_FLUSH, all pending output is</span></div>
<div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;<span class="comment">  flushed to the output buffer and the output is aligned on a byte boundary, so</span></div>
<div class="line"><a name="l00278"></a><span class="lineno">  278</span>&#160;<span class="comment">  that the decompressor can get all input data available so far. (In particular</span></div>
<div class="line"><a name="l00279"></a><span class="lineno">  279</span>&#160;<span class="comment">  avail_in is zero after the call if enough output space has been provided</span></div>
<div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160;<span class="comment">  before the call.)  Flushing may degrade compression for some compression</span></div>
<div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160;<span class="comment">  algorithms and so it should be used only when necessary.</span></div>
<div class="line"><a name="l00282"></a><span class="lineno">  282</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00283"></a><span class="lineno">  283</span>&#160;<span class="comment">    If flush is set to Z_FULL_FLUSH, all output is flushed as with</span></div>
<div class="line"><a name="l00284"></a><span class="lineno">  284</span>&#160;<span class="comment">  Z_SYNC_FLUSH, and the compression state is reset so that decompression can</span></div>
<div class="line"><a name="l00285"></a><span class="lineno">  285</span>&#160;<span class="comment">  restart from this point if previous compressed data has been damaged or if</span></div>
<div class="line"><a name="l00286"></a><span class="lineno">  286</span>&#160;<span class="comment">  random access is desired. Using Z_FULL_FLUSH too often can seriously degrade</span></div>
<div class="line"><a name="l00287"></a><span class="lineno">  287</span>&#160;<span class="comment">  compression.</span></div>
<div class="line"><a name="l00288"></a><span class="lineno">  288</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;<span class="comment">    If deflate returns with avail_out == 0, this function must be called again</span></div>
<div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160;<span class="comment">  with the same value of the flush parameter and more output space (updated</span></div>
<div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;<span class="comment">  avail_out), until the flush is complete (deflate returns with non-zero</span></div>
<div class="line"><a name="l00292"></a><span class="lineno">  292</span>&#160;<span class="comment">  avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that</span></div>
<div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160;<span class="comment">  avail_out is greater than six to avoid repeated flush markers due to</span></div>
<div class="line"><a name="l00294"></a><span class="lineno">  294</span>&#160;<span class="comment">  avail_out == 0 on return.</span></div>
<div class="line"><a name="l00295"></a><span class="lineno">  295</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00296"></a><span class="lineno">  296</span>&#160;<span class="comment">    If the parameter flush is set to Z_FINISH, pending input is processed,</span></div>
<div class="line"><a name="l00297"></a><span class="lineno">  297</span>&#160;<span class="comment">  pending output is flushed and deflate returns with Z_STREAM_END if there</span></div>
<div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;<span class="comment">  was enough output space; if deflate returns with Z_OK, this function must be</span></div>
<div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;<span class="comment">  called again with Z_FINISH and more output space (updated avail_out) but no</span></div>
<div class="line"><a name="l00300"></a><span class="lineno">  300</span>&#160;<span class="comment">  more input data, until it returns with Z_STREAM_END or an error. After</span></div>
<div class="line"><a name="l00301"></a><span class="lineno">  301</span>&#160;<span class="comment">  deflate has returned Z_STREAM_END, the only possible operations on the</span></div>
<div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160;<span class="comment">  stream are deflateReset or deflateEnd.</span></div>
<div class="line"><a name="l00303"></a><span class="lineno">  303</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160;<span class="comment">    Z_FINISH can be used immediately after deflateInit if all the compression</span></div>
<div class="line"><a name="l00305"></a><span class="lineno">  305</span>&#160;<span class="comment">  is to be done in a single step. In this case, avail_out must be at least</span></div>
<div class="line"><a name="l00306"></a><span class="lineno">  306</span>&#160;<span class="comment">  the value returned by deflateBound (see below). If deflate does not return</span></div>
<div class="line"><a name="l00307"></a><span class="lineno">  307</span>&#160;<span class="comment">  Z_STREAM_END, then it must be called again as described above.</span></div>
<div class="line"><a name="l00308"></a><span class="lineno">  308</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00309"></a><span class="lineno">  309</span>&#160;<span class="comment">    deflate() sets strm-&gt;adler to the adler32 checksum of all input read</span></div>
<div class="line"><a name="l00310"></a><span class="lineno">  310</span>&#160;<span class="comment">  so far (that is, total_in bytes).</span></div>
<div class="line"><a name="l00311"></a><span class="lineno">  311</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160;<span class="comment">    deflate() may update strm-&gt;data_type if it can make a good guess about</span></div>
<div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160;<span class="comment">  the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered</span></div>
<div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160;<span class="comment">  binary. This field is only for information purposes and does not affect</span></div>
<div class="line"><a name="l00315"></a><span class="lineno">  315</span>&#160;<span class="comment">  the compression algorithm in any manner.</span></div>
<div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;<span class="comment">    deflate() returns Z_OK if some progress has been made (more input</span></div>
<div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160;<span class="comment">  processed or more output produced), Z_STREAM_END if all input has been</span></div>
<div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160;<span class="comment">  consumed and all output has been produced (only when flush is set to</span></div>
<div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;<span class="comment">  Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example</span></div>
<div class="line"><a name="l00321"></a><span class="lineno">  321</span>&#160;<span class="comment">  if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible</span></div>
<div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160;<span class="comment">  (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not</span></div>
<div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160;<span class="comment">  fatal, and deflate() can be called again with more input and more output</span></div>
<div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;<span class="comment">  space to continue compressing.</span></div>
<div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160; </div>
<div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160; </div>
<div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT deflateEnd OF((z_streamp strm));</div>
<div class="line"><a name="l00329"></a><span class="lineno">  329</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00330"></a><span class="lineno">  330</span>&#160;<span class="comment">     All dynamically allocated data structures for this stream are freed.</span></div>
<div class="line"><a name="l00331"></a><span class="lineno">  331</span>&#160;<span class="comment">   This function discards any unprocessed input and does not flush any</span></div>
<div class="line"><a name="l00332"></a><span class="lineno">  332</span>&#160;<span class="comment">   pending output.</span></div>
<div class="line"><a name="l00333"></a><span class="lineno">  333</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00334"></a><span class="lineno">  334</span>&#160;<span class="comment">     deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the</span></div>
<div class="line"><a name="l00335"></a><span class="lineno">  335</span>&#160;<span class="comment">   stream state was inconsistent, Z_DATA_ERROR if the stream was freed</span></div>
<div class="line"><a name="l00336"></a><span class="lineno">  336</span>&#160;<span class="comment">   prematurely (some input or output was discarded). In the error case,</span></div>
<div class="line"><a name="l00337"></a><span class="lineno">  337</span>&#160;<span class="comment">   msg may be set but then points to a static string (which must not be</span></div>
<div class="line"><a name="l00338"></a><span class="lineno">  338</span>&#160;<span class="comment">   deallocated).</span></div>
<div class="line"><a name="l00339"></a><span class="lineno">  339</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00340"></a><span class="lineno">  340</span>&#160; </div>
<div class="line"><a name="l00341"></a><span class="lineno">  341</span>&#160; </div>
<div class="line"><a name="l00342"></a><span class="lineno">  342</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00343"></a><span class="lineno">  343</span>&#160;<span class="comment">ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));</span></div>
<div class="line"><a name="l00344"></a><span class="lineno">  344</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00345"></a><span class="lineno">  345</span>&#160;<span class="comment">     Initializes the internal stream state for decompression. The fields</span></div>
<div class="line"><a name="l00346"></a><span class="lineno">  346</span>&#160;<span class="comment">   next_in, avail_in, zalloc, zfree and opaque must be initialized before by</span></div>
<div class="line"><a name="l00347"></a><span class="lineno">  347</span>&#160;<span class="comment">   the caller. If next_in is not Z_NULL and avail_in is large enough (the exact</span></div>
<div class="line"><a name="l00348"></a><span class="lineno">  348</span>&#160;<span class="comment">   value depends on the compression method), inflateInit determines the</span></div>
<div class="line"><a name="l00349"></a><span class="lineno">  349</span>&#160;<span class="comment">   compression method from the zlib header and allocates all data structures</span></div>
<div class="line"><a name="l00350"></a><span class="lineno">  350</span>&#160;<span class="comment">   accordingly; otherwise the allocation will be deferred to the first call of</span></div>
<div class="line"><a name="l00351"></a><span class="lineno">  351</span>&#160;<span class="comment">   inflate.  If zalloc and zfree are set to Z_NULL, inflateInit updates them to</span></div>
<div class="line"><a name="l00352"></a><span class="lineno">  352</span>&#160;<span class="comment">   use default allocation functions.</span></div>
<div class="line"><a name="l00353"></a><span class="lineno">  353</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00354"></a><span class="lineno">  354</span>&#160;<span class="comment">     inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough</span></div>
<div class="line"><a name="l00355"></a><span class="lineno">  355</span>&#160;<span class="comment">   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the</span></div>
<div class="line"><a name="l00356"></a><span class="lineno">  356</span>&#160;<span class="comment">   version assumed by the caller.  msg is set to null if there is no error</span></div>
<div class="line"><a name="l00357"></a><span class="lineno">  357</span>&#160;<span class="comment">   message. inflateInit does not perform any decompression apart from reading</span></div>
<div class="line"><a name="l00358"></a><span class="lineno">  358</span>&#160;<span class="comment">   the zlib header if present: this will be done by inflate().  (So next_in and</span></div>
<div class="line"><a name="l00359"></a><span class="lineno">  359</span>&#160;<span class="comment">   avail_in may be modified, but next_out and avail_out are unchanged.)</span></div>
<div class="line"><a name="l00360"></a><span class="lineno">  360</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00361"></a><span class="lineno">  361</span>&#160; </div>
<div class="line"><a name="l00362"></a><span class="lineno">  362</span>&#160; </div>
<div class="line"><a name="l00363"></a><span class="lineno">  363</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT inflate OF((z_streamp strm, <span class="keywordtype">int</span> flush));</div>
<div class="line"><a name="l00364"></a><span class="lineno">  364</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00365"></a><span class="lineno">  365</span>&#160;<span class="comment">    inflate decompresses as much data as possible, and stops when the input</span></div>
<div class="line"><a name="l00366"></a><span class="lineno">  366</span>&#160;<span class="comment">  buffer becomes empty or the output buffer becomes full. It may introduce</span></div>
<div class="line"><a name="l00367"></a><span class="lineno">  367</span>&#160;<span class="comment">  some output latency (reading input without producing any output) except when</span></div>
<div class="line"><a name="l00368"></a><span class="lineno">  368</span>&#160;<span class="comment">  forced to flush.</span></div>
<div class="line"><a name="l00369"></a><span class="lineno">  369</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00370"></a><span class="lineno">  370</span>&#160;<span class="comment">  The detailed semantics are as follows. inflate performs one or both of the</span></div>
<div class="line"><a name="l00371"></a><span class="lineno">  371</span>&#160;<span class="comment">  following actions:</span></div>
<div class="line"><a name="l00372"></a><span class="lineno">  372</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00373"></a><span class="lineno">  373</span>&#160;<span class="comment">  - Decompress more input starting at next_in and update next_in and avail_in</span></div>
<div class="line"><a name="l00374"></a><span class="lineno">  374</span>&#160;<span class="comment">    accordingly. If not all input can be processed (because there is not</span></div>
<div class="line"><a name="l00375"></a><span class="lineno">  375</span>&#160;<span class="comment">    enough room in the output buffer), next_in is updated and processing</span></div>
<div class="line"><a name="l00376"></a><span class="lineno">  376</span>&#160;<span class="comment">    will resume at this point for the next call of inflate().</span></div>
<div class="line"><a name="l00377"></a><span class="lineno">  377</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00378"></a><span class="lineno">  378</span>&#160;<span class="comment">  - Provide more output starting at next_out and update next_out and avail_out</span></div>
<div class="line"><a name="l00379"></a><span class="lineno">  379</span>&#160;<span class="comment">    accordingly.  inflate() provides as much output as possible, until there</span></div>
<div class="line"><a name="l00380"></a><span class="lineno">  380</span>&#160;<span class="comment">    is no more input data or no more space in the output buffer (see below</span></div>
<div class="line"><a name="l00381"></a><span class="lineno">  381</span>&#160;<span class="comment">    about the flush parameter).</span></div>
<div class="line"><a name="l00382"></a><span class="lineno">  382</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00383"></a><span class="lineno">  383</span>&#160;<span class="comment">  Before the call of inflate(), the application should ensure that at least</span></div>
<div class="line"><a name="l00384"></a><span class="lineno">  384</span>&#160;<span class="comment">  one of the actions is possible, by providing more input and/or consuming</span></div>
<div class="line"><a name="l00385"></a><span class="lineno">  385</span>&#160;<span class="comment">  more output, and updating the next_* and avail_* values accordingly.</span></div>
<div class="line"><a name="l00386"></a><span class="lineno">  386</span>&#160;<span class="comment">  The application can consume the uncompressed output when it wants, for</span></div>
<div class="line"><a name="l00387"></a><span class="lineno">  387</span>&#160;<span class="comment">  example when the output buffer is full (avail_out == 0), or after each</span></div>
<div class="line"><a name="l00388"></a><span class="lineno">  388</span>&#160;<span class="comment">  call of inflate(). If inflate returns Z_OK and with zero avail_out, it</span></div>
<div class="line"><a name="l00389"></a><span class="lineno">  389</span>&#160;<span class="comment">  must be called again after making room in the output buffer because there</span></div>
<div class="line"><a name="l00390"></a><span class="lineno">  390</span>&#160;<span class="comment">  might be more output pending.</span></div>
<div class="line"><a name="l00391"></a><span class="lineno">  391</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00392"></a><span class="lineno">  392</span>&#160;<span class="comment">    The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH,</span></div>
<div class="line"><a name="l00393"></a><span class="lineno">  393</span>&#160;<span class="comment">  Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much</span></div>
<div class="line"><a name="l00394"></a><span class="lineno">  394</span>&#160;<span class="comment">  output as possible to the output buffer. Z_BLOCK requests that inflate() stop</span></div>
<div class="line"><a name="l00395"></a><span class="lineno">  395</span>&#160;<span class="comment">  if and when it gets to the next deflate block boundary. When decoding the</span></div>
<div class="line"><a name="l00396"></a><span class="lineno">  396</span>&#160;<span class="comment">  zlib or gzip format, this will cause inflate() to return immediately after</span></div>
<div class="line"><a name="l00397"></a><span class="lineno">  397</span>&#160;<span class="comment">  the header and before the first block. When doing a raw inflate, inflate()</span></div>
<div class="line"><a name="l00398"></a><span class="lineno">  398</span>&#160;<span class="comment">  will go ahead and process the first block, and will return when it gets to</span></div>
<div class="line"><a name="l00399"></a><span class="lineno">  399</span>&#160;<span class="comment">  the end of that block, or when it runs out of data.</span></div>
<div class="line"><a name="l00400"></a><span class="lineno">  400</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00401"></a><span class="lineno">  401</span>&#160;<span class="comment">    The Z_BLOCK option assists in appending to or combining deflate streams.</span></div>
<div class="line"><a name="l00402"></a><span class="lineno">  402</span>&#160;<span class="comment">  Also to assist in this, on return inflate() will set strm-&gt;data_type to the</span></div>
<div class="line"><a name="l00403"></a><span class="lineno">  403</span>&#160;<span class="comment">  number of unused bits in the last byte taken from strm-&gt;next_in, plus 64</span></div>
<div class="line"><a name="l00404"></a><span class="lineno">  404</span>&#160;<span class="comment">  if inflate() is currently decoding the last block in the deflate stream,</span></div>
<div class="line"><a name="l00405"></a><span class="lineno">  405</span>&#160;<span class="comment">  plus 128 if inflate() returned immediately after decoding an end-of-block</span></div>
<div class="line"><a name="l00406"></a><span class="lineno">  406</span>&#160;<span class="comment">  code or decoding the complete header up to just before the first byte of the</span></div>
<div class="line"><a name="l00407"></a><span class="lineno">  407</span>&#160;<span class="comment">  deflate stream. The end-of-block will not be indicated until all of the</span></div>
<div class="line"><a name="l00408"></a><span class="lineno">  408</span>&#160;<span class="comment">  uncompressed data from that block has been written to strm-&gt;next_out.  The</span></div>
<div class="line"><a name="l00409"></a><span class="lineno">  409</span>&#160;<span class="comment">  number of unused bits may in general be greater than seven, except when</span></div>
<div class="line"><a name="l00410"></a><span class="lineno">  410</span>&#160;<span class="comment">  bit 7 of data_type is set, in which case the number of unused bits will be</span></div>
<div class="line"><a name="l00411"></a><span class="lineno">  411</span>&#160;<span class="comment">  less than eight.</span></div>
<div class="line"><a name="l00412"></a><span class="lineno">  412</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00413"></a><span class="lineno">  413</span>&#160;<span class="comment">    inflate() should normally be called until it returns Z_STREAM_END or an</span></div>
<div class="line"><a name="l00414"></a><span class="lineno">  414</span>&#160;<span class="comment">  error. However if all decompression is to be performed in a single step</span></div>
<div class="line"><a name="l00415"></a><span class="lineno">  415</span>&#160;<span class="comment">  (a single call of inflate), the parameter flush should be set to</span></div>
<div class="line"><a name="l00416"></a><span class="lineno">  416</span>&#160;<span class="comment">  Z_FINISH. In this case all pending input is processed and all pending</span></div>
<div class="line"><a name="l00417"></a><span class="lineno">  417</span>&#160;<span class="comment">  output is flushed; avail_out must be large enough to hold all the</span></div>
<div class="line"><a name="l00418"></a><span class="lineno">  418</span>&#160;<span class="comment">  uncompressed data. (The size of the uncompressed data may have been saved</span></div>
<div class="line"><a name="l00419"></a><span class="lineno">  419</span>&#160;<span class="comment">  by the compressor for this purpose.) The next operation on this stream must</span></div>
<div class="line"><a name="l00420"></a><span class="lineno">  420</span>&#160;<span class="comment">  be inflateEnd to deallocate the decompression state. The use of Z_FINISH</span></div>
<div class="line"><a name="l00421"></a><span class="lineno">  421</span>&#160;<span class="comment">  is never required, but can be used to inform inflate that a faster approach</span></div>
<div class="line"><a name="l00422"></a><span class="lineno">  422</span>&#160;<span class="comment">  may be used for the single inflate() call.</span></div>
<div class="line"><a name="l00423"></a><span class="lineno">  423</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00424"></a><span class="lineno">  424</span>&#160;<span class="comment">     In this implementation, inflate() always flushes as much output as</span></div>
<div class="line"><a name="l00425"></a><span class="lineno">  425</span>&#160;<span class="comment">  possible to the output buffer, and always uses the faster approach on the</span></div>
<div class="line"><a name="l00426"></a><span class="lineno">  426</span>&#160;<span class="comment">  first call. So the only effect of the flush parameter in this implementation</span></div>
<div class="line"><a name="l00427"></a><span class="lineno">  427</span>&#160;<span class="comment">  is on the return value of inflate(), as noted below, or when it returns early</span></div>
<div class="line"><a name="l00428"></a><span class="lineno">  428</span>&#160;<span class="comment">  because Z_BLOCK is used.</span></div>
<div class="line"><a name="l00429"></a><span class="lineno">  429</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00430"></a><span class="lineno">  430</span>&#160;<span class="comment">     If a preset dictionary is needed after this call (see inflateSetDictionary</span></div>
<div class="line"><a name="l00431"></a><span class="lineno">  431</span>&#160;<span class="comment">  below), inflate sets strm-&gt;adler to the adler32 checksum of the dictionary</span></div>
<div class="line"><a name="l00432"></a><span class="lineno">  432</span>&#160;<span class="comment">  chosen by the compressor and returns Z_NEED_DICT; otherwise it sets</span></div>
<div class="line"><a name="l00433"></a><span class="lineno">  433</span>&#160;<span class="comment">  strm-&gt;adler to the adler32 checksum of all output produced so far (that is,</span></div>
<div class="line"><a name="l00434"></a><span class="lineno">  434</span>&#160;<span class="comment">  total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described</span></div>
<div class="line"><a name="l00435"></a><span class="lineno">  435</span>&#160;<span class="comment">  below. At the end of the stream, inflate() checks that its computed adler32</span></div>
<div class="line"><a name="l00436"></a><span class="lineno">  436</span>&#160;<span class="comment">  checksum is equal to that saved by the compressor and returns Z_STREAM_END</span></div>
<div class="line"><a name="l00437"></a><span class="lineno">  437</span>&#160;<span class="comment">  only if the checksum is correct.</span></div>
<div class="line"><a name="l00438"></a><span class="lineno">  438</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00439"></a><span class="lineno">  439</span>&#160;<span class="comment">    inflate() will decompress and check either zlib-wrapped or gzip-wrapped</span></div>
<div class="line"><a name="l00440"></a><span class="lineno">  440</span>&#160;<span class="comment">  deflate data.  The header type is detected automatically.  Any information</span></div>
<div class="line"><a name="l00441"></a><span class="lineno">  441</span>&#160;<span class="comment">  contained in the gzip header is not retained, so applications that need that</span></div>
<div class="line"><a name="l00442"></a><span class="lineno">  442</span>&#160;<span class="comment">  information should instead use raw inflate, see inflateInit2() below, or</span></div>
<div class="line"><a name="l00443"></a><span class="lineno">  443</span>&#160;<span class="comment">  inflateBack() and perform their own processing of the gzip header and</span></div>
<div class="line"><a name="l00444"></a><span class="lineno">  444</span>&#160;<span class="comment">  trailer.</span></div>
<div class="line"><a name="l00445"></a><span class="lineno">  445</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00446"></a><span class="lineno">  446</span>&#160;<span class="comment">    inflate() returns Z_OK if some progress has been made (more input processed</span></div>
<div class="line"><a name="l00447"></a><span class="lineno">  447</span>&#160;<span class="comment">  or more output produced), Z_STREAM_END if the end of the compressed data has</span></div>
<div class="line"><a name="l00448"></a><span class="lineno">  448</span>&#160;<span class="comment">  been reached and all uncompressed output has been produced, Z_NEED_DICT if a</span></div>
<div class="line"><a name="l00449"></a><span class="lineno">  449</span>&#160;<span class="comment">  preset dictionary is needed at this point, Z_DATA_ERROR if the input data was</span></div>
<div class="line"><a name="l00450"></a><span class="lineno">  450</span>&#160;<span class="comment">  corrupted (input stream not conforming to the zlib format or incorrect check</span></div>
<div class="line"><a name="l00451"></a><span class="lineno">  451</span>&#160;<span class="comment">  value), Z_STREAM_ERROR if the stream structure was inconsistent (for example</span></div>
<div class="line"><a name="l00452"></a><span class="lineno">  452</span>&#160;<span class="comment">  if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory,</span></div>
<div class="line"><a name="l00453"></a><span class="lineno">  453</span>&#160;<span class="comment">  Z_BUF_ERROR if no progress is possible or if there was not enough room in the</span></div>
<div class="line"><a name="l00454"></a><span class="lineno">  454</span>&#160;<span class="comment">  output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and</span></div>
<div class="line"><a name="l00455"></a><span class="lineno">  455</span>&#160;<span class="comment">  inflate() can be called again with more input and more output space to</span></div>
<div class="line"><a name="l00456"></a><span class="lineno">  456</span>&#160;<span class="comment">  continue decompressing. If Z_DATA_ERROR is returned, the application may then</span></div>
<div class="line"><a name="l00457"></a><span class="lineno">  457</span>&#160;<span class="comment">  call inflateSync() to look for a good compression block if a partial recovery</span></div>
<div class="line"><a name="l00458"></a><span class="lineno">  458</span>&#160;<span class="comment">  of the data is desired.</span></div>
<div class="line"><a name="l00459"></a><span class="lineno">  459</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00460"></a><span class="lineno">  460</span>&#160; </div>
<div class="line"><a name="l00461"></a><span class="lineno">  461</span>&#160; </div>
<div class="line"><a name="l00462"></a><span class="lineno">  462</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT inflateEnd OF((z_streamp strm));</div>
<div class="line"><a name="l00463"></a><span class="lineno">  463</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00464"></a><span class="lineno">  464</span>&#160;<span class="comment">     All dynamically allocated data structures for this stream are freed.</span></div>
<div class="line"><a name="l00465"></a><span class="lineno">  465</span>&#160;<span class="comment">   This function discards any unprocessed input and does not flush any</span></div>
<div class="line"><a name="l00466"></a><span class="lineno">  466</span>&#160;<span class="comment">   pending output.</span></div>
<div class="line"><a name="l00467"></a><span class="lineno">  467</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00468"></a><span class="lineno">  468</span>&#160;<span class="comment">     inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state</span></div>
<div class="line"><a name="l00469"></a><span class="lineno">  469</span>&#160;<span class="comment">   was inconsistent. In the error case, msg may be set but then points to a</span></div>
<div class="line"><a name="l00470"></a><span class="lineno">  470</span>&#160;<span class="comment">   static string (which must not be deallocated).</span></div>
<div class="line"><a name="l00471"></a><span class="lineno">  471</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00472"></a><span class="lineno">  472</span>&#160; </div>
<div class="line"><a name="l00473"></a><span class="lineno">  473</span>&#160;                        <span class="comment">/* Advanced functions */</span></div>
<div class="line"><a name="l00474"></a><span class="lineno">  474</span>&#160; </div>
<div class="line"><a name="l00475"></a><span class="lineno">  475</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00476"></a><span class="lineno">  476</span>&#160;<span class="comment">    The following functions are needed only in some special applications.</span></div>
<div class="line"><a name="l00477"></a><span class="lineno">  477</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00478"></a><span class="lineno">  478</span>&#160; </div>
<div class="line"><a name="l00479"></a><span class="lineno">  479</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00480"></a><span class="lineno">  480</span>&#160;<span class="comment">ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,</span></div>
<div class="line"><a name="l00481"></a><span class="lineno">  481</span>&#160;<span class="comment">                                     int  level,</span></div>
<div class="line"><a name="l00482"></a><span class="lineno">  482</span>&#160;<span class="comment">                                     int  method,</span></div>
<div class="line"><a name="l00483"></a><span class="lineno">  483</span>&#160;<span class="comment">                                     int  windowBits,</span></div>
<div class="line"><a name="l00484"></a><span class="lineno">  484</span>&#160;<span class="comment">                                     int  memLevel,</span></div>
<div class="line"><a name="l00485"></a><span class="lineno">  485</span>&#160;<span class="comment">                                     int  strategy));</span></div>
<div class="line"><a name="l00486"></a><span class="lineno">  486</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00487"></a><span class="lineno">  487</span>&#160;<span class="comment">     This is another version of deflateInit with more compression options. The</span></div>
<div class="line"><a name="l00488"></a><span class="lineno">  488</span>&#160;<span class="comment">   fields next_in, zalloc, zfree and opaque must be initialized before by</span></div>
<div class="line"><a name="l00489"></a><span class="lineno">  489</span>&#160;<span class="comment">   the caller.</span></div>
<div class="line"><a name="l00490"></a><span class="lineno">  490</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00491"></a><span class="lineno">  491</span>&#160;<span class="comment">     The method parameter is the compression method. It must be Z_DEFLATED in</span></div>
<div class="line"><a name="l00492"></a><span class="lineno">  492</span>&#160;<span class="comment">   this version of the library.</span></div>
<div class="line"><a name="l00493"></a><span class="lineno">  493</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00494"></a><span class="lineno">  494</span>&#160;<span class="comment">     The windowBits parameter is the base two logarithm of the window size</span></div>
<div class="line"><a name="l00495"></a><span class="lineno">  495</span>&#160;<span class="comment">   (the size of the history buffer). It should be in the range 8..15 for this</span></div>
<div class="line"><a name="l00496"></a><span class="lineno">  496</span>&#160;<span class="comment">   version of the library. Larger values of this parameter result in better</span></div>
<div class="line"><a name="l00497"></a><span class="lineno">  497</span>&#160;<span class="comment">   compression at the expense of memory usage. The default value is 15 if</span></div>
<div class="line"><a name="l00498"></a><span class="lineno">  498</span>&#160;<span class="comment">   deflateInit is used instead.</span></div>
<div class="line"><a name="l00499"></a><span class="lineno">  499</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00500"></a><span class="lineno">  500</span>&#160;<span class="comment">     windowBits can also be -8..-15 for raw deflate. In this case, -windowBits</span></div>
<div class="line"><a name="l00501"></a><span class="lineno">  501</span>&#160;<span class="comment">   determines the window size. deflate() will then generate raw deflate data</span></div>
<div class="line"><a name="l00502"></a><span class="lineno">  502</span>&#160;<span class="comment">   with no zlib header or trailer, and will not compute an adler32 check value.</span></div>
<div class="line"><a name="l00503"></a><span class="lineno">  503</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00504"></a><span class="lineno">  504</span>&#160;<span class="comment">     windowBits can also be greater than 15 for optional gzip encoding. Add</span></div>
<div class="line"><a name="l00505"></a><span class="lineno">  505</span>&#160;<span class="comment">   16 to windowBits to write a simple gzip header and trailer around the</span></div>
<div class="line"><a name="l00506"></a><span class="lineno">  506</span>&#160;<span class="comment">   compressed data instead of a zlib wrapper. The gzip header will have no</span></div>
<div class="line"><a name="l00507"></a><span class="lineno">  507</span>&#160;<span class="comment">   file name, no extra data, no comment, no modification time (set to zero),</span></div>
<div class="line"><a name="l00508"></a><span class="lineno">  508</span>&#160;<span class="comment">   no header crc, and the operating system will be set to 255 (unknown).  If a</span></div>
<div class="line"><a name="l00509"></a><span class="lineno">  509</span>&#160;<span class="comment">   gzip stream is being written, strm-&gt;adler is a crc32 instead of an adler32.</span></div>
<div class="line"><a name="l00510"></a><span class="lineno">  510</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00511"></a><span class="lineno">  511</span>&#160;<span class="comment">     The memLevel parameter specifies how much memory should be allocated</span></div>
<div class="line"><a name="l00512"></a><span class="lineno">  512</span>&#160;<span class="comment">   for the internal compression state. memLevel=1 uses minimum memory but</span></div>
<div class="line"><a name="l00513"></a><span class="lineno">  513</span>&#160;<span class="comment">   is slow and reduces compression ratio; memLevel=9 uses maximum memory</span></div>
<div class="line"><a name="l00514"></a><span class="lineno">  514</span>&#160;<span class="comment">   for optimal speed. The default value is 8. See zconf.h for total memory</span></div>
<div class="line"><a name="l00515"></a><span class="lineno">  515</span>&#160;<span class="comment">   usage as a function of windowBits and memLevel.</span></div>
<div class="line"><a name="l00516"></a><span class="lineno">  516</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00517"></a><span class="lineno">  517</span>&#160;<span class="comment">     The strategy parameter is used to tune the compression algorithm. Use the</span></div>
<div class="line"><a name="l00518"></a><span class="lineno">  518</span>&#160;<span class="comment">   value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a</span></div>
<div class="line"><a name="l00519"></a><span class="lineno">  519</span>&#160;<span class="comment">   filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no</span></div>
<div class="line"><a name="l00520"></a><span class="lineno">  520</span>&#160;<span class="comment">   string match), or Z_RLE to limit match distances to one (run-length</span></div>
<div class="line"><a name="l00521"></a><span class="lineno">  521</span>&#160;<span class="comment">   encoding). Filtered data consists mostly of small values with a somewhat</span></div>
<div class="line"><a name="l00522"></a><span class="lineno">  522</span>&#160;<span class="comment">   random distribution. In this case, the compression algorithm is tuned to</span></div>
<div class="line"><a name="l00523"></a><span class="lineno">  523</span>&#160;<span class="comment">   compress them better. The effect of Z_FILTERED is to force more Huffman</span></div>
<div class="line"><a name="l00524"></a><span class="lineno">  524</span>&#160;<span class="comment">   coding and less string matching; it is somewhat intermediate between</span></div>
<div class="line"><a name="l00525"></a><span class="lineno">  525</span>&#160;<span class="comment">   Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as</span></div>
<div class="line"><a name="l00526"></a><span class="lineno">  526</span>&#160;<span class="comment">   Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy</span></div>
<div class="line"><a name="l00527"></a><span class="lineno">  527</span>&#160;<span class="comment">   parameter only affects the compression ratio but not the correctness of the</span></div>
<div class="line"><a name="l00528"></a><span class="lineno">  528</span>&#160;<span class="comment">   compressed output even if it is not set appropriately.  Z_FIXED prevents the</span></div>
<div class="line"><a name="l00529"></a><span class="lineno">  529</span>&#160;<span class="comment">   use of dynamic Huffman codes, allowing for a simpler decoder for special</span></div>
<div class="line"><a name="l00530"></a><span class="lineno">  530</span>&#160;<span class="comment">   applications.</span></div>
<div class="line"><a name="l00531"></a><span class="lineno">  531</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00532"></a><span class="lineno">  532</span>&#160;<span class="comment">      deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough</span></div>
<div class="line"><a name="l00533"></a><span class="lineno">  533</span>&#160;<span class="comment">   memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid</span></div>
<div class="line"><a name="l00534"></a><span class="lineno">  534</span>&#160;<span class="comment">   method). msg is set to null if there is no error message.  deflateInit2 does</span></div>
<div class="line"><a name="l00535"></a><span class="lineno">  535</span>&#160;<span class="comment">   not perform any compression: this will be done by deflate().</span></div>
<div class="line"><a name="l00536"></a><span class="lineno">  536</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00537"></a><span class="lineno">  537</span>&#160; </div>
<div class="line"><a name="l00538"></a><span class="lineno">  538</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT deflateSetDictionary OF((z_streamp strm,</div>
<div class="line"><a name="l00539"></a><span class="lineno">  539</span>&#160;                                             <span class="keyword">const</span> Bytef *dictionary,</div>
<div class="line"><a name="l00540"></a><span class="lineno">  540</span>&#160;                                             uInt  dictLength));</div>
<div class="line"><a name="l00541"></a><span class="lineno">  541</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00542"></a><span class="lineno">  542</span>&#160;<span class="comment">     Initializes the compression dictionary from the given byte sequence</span></div>
<div class="line"><a name="l00543"></a><span class="lineno">  543</span>&#160;<span class="comment">   without producing any compressed output. This function must be called</span></div>
<div class="line"><a name="l00544"></a><span class="lineno">  544</span>&#160;<span class="comment">   immediately after deflateInit, deflateInit2 or deflateReset, before any</span></div>
<div class="line"><a name="l00545"></a><span class="lineno">  545</span>&#160;<span class="comment">   call of deflate. The compressor and decompressor must use exactly the same</span></div>
<div class="line"><a name="l00546"></a><span class="lineno">  546</span>&#160;<span class="comment">   dictionary (see inflateSetDictionary).</span></div>
<div class="line"><a name="l00547"></a><span class="lineno">  547</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00548"></a><span class="lineno">  548</span>&#160;<span class="comment">     The dictionary should consist of strings (byte sequences) that are likely</span></div>
<div class="line"><a name="l00549"></a><span class="lineno">  549</span>&#160;<span class="comment">   to be encountered later in the data to be compressed, with the most commonly</span></div>
<div class="line"><a name="l00550"></a><span class="lineno">  550</span>&#160;<span class="comment">   used strings preferably put towards the end of the dictionary. Using a</span></div>
<div class="line"><a name="l00551"></a><span class="lineno">  551</span>&#160;<span class="comment">   dictionary is most useful when the data to be compressed is short and can be</span></div>
<div class="line"><a name="l00552"></a><span class="lineno">  552</span>&#160;<span class="comment">   predicted with good accuracy; the data can then be compressed better than</span></div>
<div class="line"><a name="l00553"></a><span class="lineno">  553</span>&#160;<span class="comment">   with the default empty dictionary.</span></div>
<div class="line"><a name="l00554"></a><span class="lineno">  554</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00555"></a><span class="lineno">  555</span>&#160;<span class="comment">     Depending on the size of the compression data structures selected by</span></div>
<div class="line"><a name="l00556"></a><span class="lineno">  556</span>&#160;<span class="comment">   deflateInit or deflateInit2, a part of the dictionary may in effect be</span></div>
<div class="line"><a name="l00557"></a><span class="lineno">  557</span>&#160;<span class="comment">   discarded, for example if the dictionary is larger than the window size in</span></div>
<div class="line"><a name="l00558"></a><span class="lineno">  558</span>&#160;<span class="comment">   deflate or deflate2. Thus the strings most likely to be useful should be</span></div>
<div class="line"><a name="l00559"></a><span class="lineno">  559</span>&#160;<span class="comment">   put at the end of the dictionary, not at the front. In addition, the</span></div>
<div class="line"><a name="l00560"></a><span class="lineno">  560</span>&#160;<span class="comment">   current implementation of deflate will use at most the window size minus</span></div>
<div class="line"><a name="l00561"></a><span class="lineno">  561</span>&#160;<span class="comment">   262 bytes of the provided dictionary.</span></div>
<div class="line"><a name="l00562"></a><span class="lineno">  562</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00563"></a><span class="lineno">  563</span>&#160;<span class="comment">     Upon return of this function, strm-&gt;adler is set to the adler32 value</span></div>
<div class="line"><a name="l00564"></a><span class="lineno">  564</span>&#160;<span class="comment">   of the dictionary; the decompressor may later use this value to determine</span></div>
<div class="line"><a name="l00565"></a><span class="lineno">  565</span>&#160;<span class="comment">   which dictionary has been used by the compressor. (The adler32 value</span></div>
<div class="line"><a name="l00566"></a><span class="lineno">  566</span>&#160;<span class="comment">   applies to the whole dictionary even if only a subset of the dictionary is</span></div>
<div class="line"><a name="l00567"></a><span class="lineno">  567</span>&#160;<span class="comment">   actually used by the compressor.) If a raw deflate was requested, then the</span></div>
<div class="line"><a name="l00568"></a><span class="lineno">  568</span>&#160;<span class="comment">   adler32 value is not computed and strm-&gt;adler is not set.</span></div>
<div class="line"><a name="l00569"></a><span class="lineno">  569</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00570"></a><span class="lineno">  570</span>&#160;<span class="comment">     deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a</span></div>
<div class="line"><a name="l00571"></a><span class="lineno">  571</span>&#160;<span class="comment">   parameter is invalid (such as NULL dictionary) or the stream state is</span></div>
<div class="line"><a name="l00572"></a><span class="lineno">  572</span>&#160;<span class="comment">   inconsistent (for example if deflate has already been called for this stream</span></div>
<div class="line"><a name="l00573"></a><span class="lineno">  573</span>&#160;<span class="comment">   or if the compression method is bsort). deflateSetDictionary does not</span></div>
<div class="line"><a name="l00574"></a><span class="lineno">  574</span>&#160;<span class="comment">   perform any compression: this will be done by deflate().</span></div>
<div class="line"><a name="l00575"></a><span class="lineno">  575</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00576"></a><span class="lineno">  576</span>&#160; </div>
<div class="line"><a name="l00577"></a><span class="lineno">  577</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT deflateCopy OF((z_streamp dest,</div>
<div class="line"><a name="l00578"></a><span class="lineno">  578</span>&#160;                                    z_streamp source));</div>
<div class="line"><a name="l00579"></a><span class="lineno">  579</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00580"></a><span class="lineno">  580</span>&#160;<span class="comment">     Sets the destination stream as a complete copy of the source stream.</span></div>
<div class="line"><a name="l00581"></a><span class="lineno">  581</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00582"></a><span class="lineno">  582</span>&#160;<span class="comment">     This function can be useful when several compression strategies will be</span></div>
<div class="line"><a name="l00583"></a><span class="lineno">  583</span>&#160;<span class="comment">   tried, for example when there are several ways of pre-processing the input</span></div>
<div class="line"><a name="l00584"></a><span class="lineno">  584</span>&#160;<span class="comment">   data with a filter. The streams that will be discarded should then be freed</span></div>
<div class="line"><a name="l00585"></a><span class="lineno">  585</span>&#160;<span class="comment">   by calling deflateEnd.  Note that deflateCopy duplicates the internal</span></div>
<div class="line"><a name="l00586"></a><span class="lineno">  586</span>&#160;<span class="comment">   compression state which can be quite large, so this strategy is slow and</span></div>
<div class="line"><a name="l00587"></a><span class="lineno">  587</span>&#160;<span class="comment">   can consume lots of memory.</span></div>
<div class="line"><a name="l00588"></a><span class="lineno">  588</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00589"></a><span class="lineno">  589</span>&#160;<span class="comment">     deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not</span></div>
<div class="line"><a name="l00590"></a><span class="lineno">  590</span>&#160;<span class="comment">   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent</span></div>
<div class="line"><a name="l00591"></a><span class="lineno">  591</span>&#160;<span class="comment">   (such as zalloc being NULL). msg is left unchanged in both source and</span></div>
<div class="line"><a name="l00592"></a><span class="lineno">  592</span>&#160;<span class="comment">   destination.</span></div>
<div class="line"><a name="l00593"></a><span class="lineno">  593</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00594"></a><span class="lineno">  594</span>&#160; </div>
<div class="line"><a name="l00595"></a><span class="lineno">  595</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT deflateReset OF((z_streamp strm));</div>
<div class="line"><a name="l00596"></a><span class="lineno">  596</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00597"></a><span class="lineno">  597</span>&#160;<span class="comment">     This function is equivalent to deflateEnd followed by deflateInit,</span></div>
<div class="line"><a name="l00598"></a><span class="lineno">  598</span>&#160;<span class="comment">   but does not free and reallocate all the internal compression state.</span></div>
<div class="line"><a name="l00599"></a><span class="lineno">  599</span>&#160;<span class="comment">   The stream will keep the same compression level and any other attributes</span></div>
<div class="line"><a name="l00600"></a><span class="lineno">  600</span>&#160;<span class="comment">   that may have been set by deflateInit2.</span></div>
<div class="line"><a name="l00601"></a><span class="lineno">  601</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00602"></a><span class="lineno">  602</span>&#160;<span class="comment">      deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source</span></div>
<div class="line"><a name="l00603"></a><span class="lineno">  603</span>&#160;<span class="comment">   stream state was inconsistent (such as zalloc or state being NULL).</span></div>
<div class="line"><a name="l00604"></a><span class="lineno">  604</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00605"></a><span class="lineno">  605</span>&#160; </div>
<div class="line"><a name="l00606"></a><span class="lineno">  606</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT deflateParams OF((z_streamp strm,</div>
<div class="line"><a name="l00607"></a><span class="lineno">  607</span>&#160;                                      <span class="keywordtype">int</span> level,</div>
<div class="line"><a name="l00608"></a><span class="lineno">  608</span>&#160;                                      <span class="keywordtype">int</span> strategy));</div>
<div class="line"><a name="l00609"></a><span class="lineno">  609</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00610"></a><span class="lineno">  610</span>&#160;<span class="comment">     Dynamically update the compression level and compression strategy.  The</span></div>
<div class="line"><a name="l00611"></a><span class="lineno">  611</span>&#160;<span class="comment">   interpretation of level and strategy is as in deflateInit2.  This can be</span></div>
<div class="line"><a name="l00612"></a><span class="lineno">  612</span>&#160;<span class="comment">   used to switch between compression and straight copy of the input data, or</span></div>
<div class="line"><a name="l00613"></a><span class="lineno">  613</span>&#160;<span class="comment">   to switch to a different kind of input data requiring a different</span></div>
<div class="line"><a name="l00614"></a><span class="lineno">  614</span>&#160;<span class="comment">   strategy. If the compression level is changed, the input available so far</span></div>
<div class="line"><a name="l00615"></a><span class="lineno">  615</span>&#160;<span class="comment">   is compressed with the old level (and may be flushed); the new level will</span></div>
<div class="line"><a name="l00616"></a><span class="lineno">  616</span>&#160;<span class="comment">   take effect only at the next call of deflate().</span></div>
<div class="line"><a name="l00617"></a><span class="lineno">  617</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00618"></a><span class="lineno">  618</span>&#160;<span class="comment">     Before the call of deflateParams, the stream state must be set as for</span></div>
<div class="line"><a name="l00619"></a><span class="lineno">  619</span>&#160;<span class="comment">   a call of deflate(), since the currently available input may have to</span></div>
<div class="line"><a name="l00620"></a><span class="lineno">  620</span>&#160;<span class="comment">   be compressed and flushed. In particular, strm-&gt;avail_out must be non-zero.</span></div>
<div class="line"><a name="l00621"></a><span class="lineno">  621</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00622"></a><span class="lineno">  622</span>&#160;<span class="comment">     deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source</span></div>
<div class="line"><a name="l00623"></a><span class="lineno">  623</span>&#160;<span class="comment">   stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR</span></div>
<div class="line"><a name="l00624"></a><span class="lineno">  624</span>&#160;<span class="comment">   if strm-&gt;avail_out was zero.</span></div>
<div class="line"><a name="l00625"></a><span class="lineno">  625</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00626"></a><span class="lineno">  626</span>&#160; </div>
<div class="line"><a name="l00627"></a><span class="lineno">  627</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT deflateTune OF((z_streamp strm,</div>
<div class="line"><a name="l00628"></a><span class="lineno">  628</span>&#160;                                    <span class="keywordtype">int</span> good_length,</div>
<div class="line"><a name="l00629"></a><span class="lineno">  629</span>&#160;                                    <span class="keywordtype">int</span> max_lazy,</div>
<div class="line"><a name="l00630"></a><span class="lineno">  630</span>&#160;                                    <span class="keywordtype">int</span> nice_length,</div>
<div class="line"><a name="l00631"></a><span class="lineno">  631</span>&#160;                                    <span class="keywordtype">int</span> max_chain));</div>
<div class="line"><a name="l00632"></a><span class="lineno">  632</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00633"></a><span class="lineno">  633</span>&#160;<span class="comment">     Fine tune deflate&#39;s internal compression parameters.  This should only be</span></div>
<div class="line"><a name="l00634"></a><span class="lineno">  634</span>&#160;<span class="comment">   used by someone who understands the algorithm used by zlib&#39;s deflate for</span></div>
<div class="line"><a name="l00635"></a><span class="lineno">  635</span>&#160;<span class="comment">   searching for the best matching string, and even then only by the most</span></div>
<div class="line"><a name="l00636"></a><span class="lineno">  636</span>&#160;<span class="comment">   fanatic optimizer trying to squeeze out the last compressed bit for their</span></div>
<div class="line"><a name="l00637"></a><span class="lineno">  637</span>&#160;<span class="comment">   specific input data.  Read the deflate.c source code for the meaning of the</span></div>
<div class="line"><a name="l00638"></a><span class="lineno">  638</span>&#160;<span class="comment">   max_lazy, good_length, nice_length, and max_chain parameters.</span></div>
<div class="line"><a name="l00639"></a><span class="lineno">  639</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00640"></a><span class="lineno">  640</span>&#160;<span class="comment">     deflateTune() can be called after deflateInit() or deflateInit2(), and</span></div>
<div class="line"><a name="l00641"></a><span class="lineno">  641</span>&#160;<span class="comment">   returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.</span></div>
<div class="line"><a name="l00642"></a><span class="lineno">  642</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00643"></a><span class="lineno">  643</span>&#160; </div>
<div class="line"><a name="l00644"></a><span class="lineno">  644</span>&#160;ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,</div>
<div class="line"><a name="l00645"></a><span class="lineno">  645</span>&#160;                                       uLong sourceLen));</div>
<div class="line"><a name="l00646"></a><span class="lineno">  646</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00647"></a><span class="lineno">  647</span>&#160;<span class="comment">     deflateBound() returns an upper bound on the compressed size after</span></div>
<div class="line"><a name="l00648"></a><span class="lineno">  648</span>&#160;<span class="comment">   deflation of sourceLen bytes.  It must be called after deflateInit()</span></div>
<div class="line"><a name="l00649"></a><span class="lineno">  649</span>&#160;<span class="comment">   or deflateInit2().  This would be used to allocate an output buffer</span></div>
<div class="line"><a name="l00650"></a><span class="lineno">  650</span>&#160;<span class="comment">   for deflation in a single pass, and so would be called before deflate().</span></div>
<div class="line"><a name="l00651"></a><span class="lineno">  651</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00652"></a><span class="lineno">  652</span>&#160; </div>
<div class="line"><a name="l00653"></a><span class="lineno">  653</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT deflatePrime OF((z_streamp strm,</div>
<div class="line"><a name="l00654"></a><span class="lineno">  654</span>&#160;                                     <span class="keywordtype">int</span> bits,</div>
<div class="line"><a name="l00655"></a><span class="lineno">  655</span>&#160;                                     <span class="keywordtype">int</span> value));</div>
<div class="line"><a name="l00656"></a><span class="lineno">  656</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00657"></a><span class="lineno">  657</span>&#160;<span class="comment">     deflatePrime() inserts bits in the deflate output stream.  The intent</span></div>
<div class="line"><a name="l00658"></a><span class="lineno">  658</span>&#160;<span class="comment">  is that this function is used to start off the deflate output with the</span></div>
<div class="line"><a name="l00659"></a><span class="lineno">  659</span>&#160;<span class="comment">  bits leftover from a previous deflate stream when appending to it.  As such,</span></div>
<div class="line"><a name="l00660"></a><span class="lineno">  660</span>&#160;<span class="comment">  this function can only be used for raw deflate, and must be used before the</span></div>
<div class="line"><a name="l00661"></a><span class="lineno">  661</span>&#160;<span class="comment">  first deflate() call after a deflateInit2() or deflateReset().  bits must be</span></div>
<div class="line"><a name="l00662"></a><span class="lineno">  662</span>&#160;<span class="comment">  less than or equal to 16, and that many of the least significant bits of</span></div>
<div class="line"><a name="l00663"></a><span class="lineno">  663</span>&#160;<span class="comment">  value will be inserted in the output.</span></div>
<div class="line"><a name="l00664"></a><span class="lineno">  664</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00665"></a><span class="lineno">  665</span>&#160;<span class="comment">      deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source</span></div>
<div class="line"><a name="l00666"></a><span class="lineno">  666</span>&#160;<span class="comment">   stream state was inconsistent.</span></div>
<div class="line"><a name="l00667"></a><span class="lineno">  667</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00668"></a><span class="lineno">  668</span>&#160; </div>
<div class="line"><a name="l00669"></a><span class="lineno">  669</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT deflateSetHeader OF((z_streamp strm,</div>
<div class="line"><a name="l00670"></a><span class="lineno">  670</span>&#160;                                         gz_headerp head));</div>
<div class="line"><a name="l00671"></a><span class="lineno">  671</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00672"></a><span class="lineno">  672</span>&#160;<span class="comment">      deflateSetHeader() provides gzip header information for when a gzip</span></div>
<div class="line"><a name="l00673"></a><span class="lineno">  673</span>&#160;<span class="comment">   stream is requested by deflateInit2().  deflateSetHeader() may be called</span></div>
<div class="line"><a name="l00674"></a><span class="lineno">  674</span>&#160;<span class="comment">   after deflateInit2() or deflateReset() and before the first call of</span></div>
<div class="line"><a name="l00675"></a><span class="lineno">  675</span>&#160;<span class="comment">   deflate().  The text, time, os, extra field, name, and comment information</span></div>
<div class="line"><a name="l00676"></a><span class="lineno">  676</span>&#160;<span class="comment">   in the provided gz_header structure are written to the gzip header (xflag is</span></div>
<div class="line"><a name="l00677"></a><span class="lineno">  677</span>&#160;<span class="comment">   ignored -- the extra flags are set according to the compression level).  The</span></div>
<div class="line"><a name="l00678"></a><span class="lineno">  678</span>&#160;<span class="comment">   caller must assure that, if not Z_NULL, name and comment are terminated with</span></div>
<div class="line"><a name="l00679"></a><span class="lineno">  679</span>&#160;<span class="comment">   a zero byte, and that if extra is not Z_NULL, that extra_len bytes are</span></div>
<div class="line"><a name="l00680"></a><span class="lineno">  680</span>&#160;<span class="comment">   available there.  If hcrc is true, a gzip header crc is included.  Note that</span></div>
<div class="line"><a name="l00681"></a><span class="lineno">  681</span>&#160;<span class="comment">   the current versions of the command-line version of gzip (up through version</span></div>
<div class="line"><a name="l00682"></a><span class="lineno">  682</span>&#160;<span class="comment">   1.3.x) do not support header crc&#39;s, and will report that it is a &quot;multi-part</span></div>
<div class="line"><a name="l00683"></a><span class="lineno">  683</span>&#160;<span class="comment">   gzip file&quot; and give up.</span></div>
<div class="line"><a name="l00684"></a><span class="lineno">  684</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00685"></a><span class="lineno">  685</span>&#160;<span class="comment">      If deflateSetHeader is not used, the default gzip header has text false,</span></div>
<div class="line"><a name="l00686"></a><span class="lineno">  686</span>&#160;<span class="comment">   the time set to zero, and os set to 255, with no extra, name, or comment</span></div>
<div class="line"><a name="l00687"></a><span class="lineno">  687</span>&#160;<span class="comment">   fields.  The gzip header is returned to the default state by deflateReset().</span></div>
<div class="line"><a name="l00688"></a><span class="lineno">  688</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00689"></a><span class="lineno">  689</span>&#160;<span class="comment">      deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source</span></div>
<div class="line"><a name="l00690"></a><span class="lineno">  690</span>&#160;<span class="comment">   stream state was inconsistent.</span></div>
<div class="line"><a name="l00691"></a><span class="lineno">  691</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00692"></a><span class="lineno">  692</span>&#160; </div>
<div class="line"><a name="l00693"></a><span class="lineno">  693</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00694"></a><span class="lineno">  694</span>&#160;<span class="comment">ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,</span></div>
<div class="line"><a name="l00695"></a><span class="lineno">  695</span>&#160;<span class="comment">                                     int  windowBits));</span></div>
<div class="line"><a name="l00696"></a><span class="lineno">  696</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00697"></a><span class="lineno">  697</span>&#160;<span class="comment">     This is another version of inflateInit with an extra parameter. The</span></div>
<div class="line"><a name="l00698"></a><span class="lineno">  698</span>&#160;<span class="comment">   fields next_in, avail_in, zalloc, zfree and opaque must be initialized</span></div>
<div class="line"><a name="l00699"></a><span class="lineno">  699</span>&#160;<span class="comment">   before by the caller.</span></div>
<div class="line"><a name="l00700"></a><span class="lineno">  700</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00701"></a><span class="lineno">  701</span>&#160;<span class="comment">     The windowBits parameter is the base two logarithm of the maximum window</span></div>
<div class="line"><a name="l00702"></a><span class="lineno">  702</span>&#160;<span class="comment">   size (the size of the history buffer).  It should be in the range 8..15 for</span></div>
<div class="line"><a name="l00703"></a><span class="lineno">  703</span>&#160;<span class="comment">   this version of the library. The default value is 15 if inflateInit is used</span></div>
<div class="line"><a name="l00704"></a><span class="lineno">  704</span>&#160;<span class="comment">   instead. windowBits must be greater than or equal to the windowBits value</span></div>
<div class="line"><a name="l00705"></a><span class="lineno">  705</span>&#160;<span class="comment">   provided to deflateInit2() while compressing, or it must be equal to 15 if</span></div>
<div class="line"><a name="l00706"></a><span class="lineno">  706</span>&#160;<span class="comment">   deflateInit2() was not used. If a compressed stream with a larger window</span></div>
<div class="line"><a name="l00707"></a><span class="lineno">  707</span>&#160;<span class="comment">   size is given as input, inflate() will return with the error code</span></div>
<div class="line"><a name="l00708"></a><span class="lineno">  708</span>&#160;<span class="comment">   Z_DATA_ERROR instead of trying to allocate a larger window.</span></div>
<div class="line"><a name="l00709"></a><span class="lineno">  709</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00710"></a><span class="lineno">  710</span>&#160;<span class="comment">     windowBits can also be -8..-15 for raw inflate. In this case, -windowBits</span></div>
<div class="line"><a name="l00711"></a><span class="lineno">  711</span>&#160;<span class="comment">   determines the window size. inflate() will then process raw deflate data,</span></div>
<div class="line"><a name="l00712"></a><span class="lineno">  712</span>&#160;<span class="comment">   not looking for a zlib or gzip header, not generating a check value, and not</span></div>
<div class="line"><a name="l00713"></a><span class="lineno">  713</span>&#160;<span class="comment">   looking for any check values for comparison at the end of the stream. This</span></div>
<div class="line"><a name="l00714"></a><span class="lineno">  714</span>&#160;<span class="comment">   is for use with other formats that use the deflate compressed data format</span></div>
<div class="line"><a name="l00715"></a><span class="lineno">  715</span>&#160;<span class="comment">   such as zip.  Those formats provide their own check values. If a custom</span></div>
<div class="line"><a name="l00716"></a><span class="lineno">  716</span>&#160;<span class="comment">   format is developed using the raw deflate format for compressed data, it is</span></div>
<div class="line"><a name="l00717"></a><span class="lineno">  717</span>&#160;<span class="comment">   recommended that a check value such as an adler32 or a crc32 be applied to</span></div>
<div class="line"><a name="l00718"></a><span class="lineno">  718</span>&#160;<span class="comment">   the uncompressed data as is done in the zlib, gzip, and zip formats.  For</span></div>
<div class="line"><a name="l00719"></a><span class="lineno">  719</span>&#160;<span class="comment">   most applications, the zlib format should be used as is. Note that comments</span></div>
<div class="line"><a name="l00720"></a><span class="lineno">  720</span>&#160;<span class="comment">   above on the use in deflateInit2() applies to the magnitude of windowBits.</span></div>
<div class="line"><a name="l00721"></a><span class="lineno">  721</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00722"></a><span class="lineno">  722</span>&#160;<span class="comment">     windowBits can also be greater than 15 for optional gzip decoding. Add</span></div>
<div class="line"><a name="l00723"></a><span class="lineno">  723</span>&#160;<span class="comment">   32 to windowBits to enable zlib and gzip decoding with automatic header</span></div>
<div class="line"><a name="l00724"></a><span class="lineno">  724</span>&#160;<span class="comment">   detection, or add 16 to decode only the gzip format (the zlib format will</span></div>
<div class="line"><a name="l00725"></a><span class="lineno">  725</span>&#160;<span class="comment">   return a Z_DATA_ERROR).  If a gzip stream is being decoded, strm-&gt;adler is</span></div>
<div class="line"><a name="l00726"></a><span class="lineno">  726</span>&#160;<span class="comment">   a crc32 instead of an adler32.</span></div>
<div class="line"><a name="l00727"></a><span class="lineno">  727</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00728"></a><span class="lineno">  728</span>&#160;<span class="comment">     inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough</span></div>
<div class="line"><a name="l00729"></a><span class="lineno">  729</span>&#160;<span class="comment">   memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg</span></div>
<div class="line"><a name="l00730"></a><span class="lineno">  730</span>&#160;<span class="comment">   is set to null if there is no error message.  inflateInit2 does not perform</span></div>
<div class="line"><a name="l00731"></a><span class="lineno">  731</span>&#160;<span class="comment">   any decompression apart from reading the zlib header if present: this will</span></div>
<div class="line"><a name="l00732"></a><span class="lineno">  732</span>&#160;<span class="comment">   be done by inflate(). (So next_in and avail_in may be modified, but next_out</span></div>
<div class="line"><a name="l00733"></a><span class="lineno">  733</span>&#160;<span class="comment">   and avail_out are unchanged.)</span></div>
<div class="line"><a name="l00734"></a><span class="lineno">  734</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00735"></a><span class="lineno">  735</span>&#160; </div>
<div class="line"><a name="l00736"></a><span class="lineno">  736</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT inflateSetDictionary OF((z_streamp strm,</div>
<div class="line"><a name="l00737"></a><span class="lineno">  737</span>&#160;                                             <span class="keyword">const</span> Bytef *dictionary,</div>
<div class="line"><a name="l00738"></a><span class="lineno">  738</span>&#160;                                             uInt  dictLength));</div>
<div class="line"><a name="l00739"></a><span class="lineno">  739</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00740"></a><span class="lineno">  740</span>&#160;<span class="comment">     Initializes the decompression dictionary from the given uncompressed byte</span></div>
<div class="line"><a name="l00741"></a><span class="lineno">  741</span>&#160;<span class="comment">   sequence. This function must be called immediately after a call of inflate,</span></div>
<div class="line"><a name="l00742"></a><span class="lineno">  742</span>&#160;<span class="comment">   if that call returned Z_NEED_DICT. The dictionary chosen by the compressor</span></div>
<div class="line"><a name="l00743"></a><span class="lineno">  743</span>&#160;<span class="comment">   can be determined from the adler32 value returned by that call of inflate.</span></div>
<div class="line"><a name="l00744"></a><span class="lineno">  744</span>&#160;<span class="comment">   The compressor and decompressor must use exactly the same dictionary (see</span></div>
<div class="line"><a name="l00745"></a><span class="lineno">  745</span>&#160;<span class="comment">   deflateSetDictionary).  For raw inflate, this function can be called</span></div>
<div class="line"><a name="l00746"></a><span class="lineno">  746</span>&#160;<span class="comment">   immediately after inflateInit2() or inflateReset() and before any call of</span></div>
<div class="line"><a name="l00747"></a><span class="lineno">  747</span>&#160;<span class="comment">   inflate() to set the dictionary.  The application must insure that the</span></div>
<div class="line"><a name="l00748"></a><span class="lineno">  748</span>&#160;<span class="comment">   dictionary that was used for compression is provided.</span></div>
<div class="line"><a name="l00749"></a><span class="lineno">  749</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00750"></a><span class="lineno">  750</span>&#160;<span class="comment">     inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a</span></div>
<div class="line"><a name="l00751"></a><span class="lineno">  751</span>&#160;<span class="comment">   parameter is invalid (such as NULL dictionary) or the stream state is</span></div>
<div class="line"><a name="l00752"></a><span class="lineno">  752</span>&#160;<span class="comment">   inconsistent, Z_DATA_ERROR if the given dictionary doesn&#39;t match the</span></div>
<div class="line"><a name="l00753"></a><span class="lineno">  753</span>&#160;<span class="comment">   expected one (incorrect adler32 value). inflateSetDictionary does not</span></div>
<div class="line"><a name="l00754"></a><span class="lineno">  754</span>&#160;<span class="comment">   perform any decompression: this will be done by subsequent calls of</span></div>
<div class="line"><a name="l00755"></a><span class="lineno">  755</span>&#160;<span class="comment">   inflate().</span></div>
<div class="line"><a name="l00756"></a><span class="lineno">  756</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00757"></a><span class="lineno">  757</span>&#160; </div>
<div class="line"><a name="l00758"></a><span class="lineno">  758</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT inflateSync OF((z_streamp strm));</div>
<div class="line"><a name="l00759"></a><span class="lineno">  759</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00760"></a><span class="lineno">  760</span>&#160;<span class="comment">    Skips invalid compressed data until a full flush point (see above the</span></div>
<div class="line"><a name="l00761"></a><span class="lineno">  761</span>&#160;<span class="comment">  description of deflate with Z_FULL_FLUSH) can be found, or until all</span></div>
<div class="line"><a name="l00762"></a><span class="lineno">  762</span>&#160;<span class="comment">  available input is skipped. No output is provided.</span></div>
<div class="line"><a name="l00763"></a><span class="lineno">  763</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00764"></a><span class="lineno">  764</span>&#160;<span class="comment">    inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR</span></div>
<div class="line"><a name="l00765"></a><span class="lineno">  765</span>&#160;<span class="comment">  if no more input was provided, Z_DATA_ERROR if no flush point has been found,</span></div>
<div class="line"><a name="l00766"></a><span class="lineno">  766</span>&#160;<span class="comment">  or Z_STREAM_ERROR if the stream structure was inconsistent. In the success</span></div>
<div class="line"><a name="l00767"></a><span class="lineno">  767</span>&#160;<span class="comment">  case, the application may save the current current value of total_in which</span></div>
<div class="line"><a name="l00768"></a><span class="lineno">  768</span>&#160;<span class="comment">  indicates where valid compressed data was found. In the error case, the</span></div>
<div class="line"><a name="l00769"></a><span class="lineno">  769</span>&#160;<span class="comment">  application may repeatedly call inflateSync, providing more input each time,</span></div>
<div class="line"><a name="l00770"></a><span class="lineno">  770</span>&#160;<span class="comment">  until success or end of the input data.</span></div>
<div class="line"><a name="l00771"></a><span class="lineno">  771</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00772"></a><span class="lineno">  772</span>&#160; </div>
<div class="line"><a name="l00773"></a><span class="lineno">  773</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT inflateCopy OF((z_streamp dest,</div>
<div class="line"><a name="l00774"></a><span class="lineno">  774</span>&#160;                                    z_streamp source));</div>
<div class="line"><a name="l00775"></a><span class="lineno">  775</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00776"></a><span class="lineno">  776</span>&#160;<span class="comment">     Sets the destination stream as a complete copy of the source stream.</span></div>
<div class="line"><a name="l00777"></a><span class="lineno">  777</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00778"></a><span class="lineno">  778</span>&#160;<span class="comment">     This function can be useful when randomly accessing a large stream.  The</span></div>
<div class="line"><a name="l00779"></a><span class="lineno">  779</span>&#160;<span class="comment">   first pass through the stream can periodically record the inflate state,</span></div>
<div class="line"><a name="l00780"></a><span class="lineno">  780</span>&#160;<span class="comment">   allowing restarting inflate at those points when randomly accessing the</span></div>
<div class="line"><a name="l00781"></a><span class="lineno">  781</span>&#160;<span class="comment">   stream.</span></div>
<div class="line"><a name="l00782"></a><span class="lineno">  782</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00783"></a><span class="lineno">  783</span>&#160;<span class="comment">     inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not</span></div>
<div class="line"><a name="l00784"></a><span class="lineno">  784</span>&#160;<span class="comment">   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent</span></div>
<div class="line"><a name="l00785"></a><span class="lineno">  785</span>&#160;<span class="comment">   (such as zalloc being NULL). msg is left unchanged in both source and</span></div>
<div class="line"><a name="l00786"></a><span class="lineno">  786</span>&#160;<span class="comment">   destination.</span></div>
<div class="line"><a name="l00787"></a><span class="lineno">  787</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00788"></a><span class="lineno">  788</span>&#160; </div>
<div class="line"><a name="l00789"></a><span class="lineno">  789</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT inflateReset OF((z_streamp strm));</div>
<div class="line"><a name="l00790"></a><span class="lineno">  790</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00791"></a><span class="lineno">  791</span>&#160;<span class="comment">     This function is equivalent to inflateEnd followed by inflateInit,</span></div>
<div class="line"><a name="l00792"></a><span class="lineno">  792</span>&#160;<span class="comment">   but does not free and reallocate all the internal decompression state.</span></div>
<div class="line"><a name="l00793"></a><span class="lineno">  793</span>&#160;<span class="comment">   The stream will keep attributes that may have been set by inflateInit2.</span></div>
<div class="line"><a name="l00794"></a><span class="lineno">  794</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00795"></a><span class="lineno">  795</span>&#160;<span class="comment">      inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source</span></div>
<div class="line"><a name="l00796"></a><span class="lineno">  796</span>&#160;<span class="comment">   stream state was inconsistent (such as zalloc or state being NULL).</span></div>
<div class="line"><a name="l00797"></a><span class="lineno">  797</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00798"></a><span class="lineno">  798</span>&#160; </div>
<div class="line"><a name="l00799"></a><span class="lineno">  799</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT inflatePrime OF((z_streamp strm,</div>
<div class="line"><a name="l00800"></a><span class="lineno">  800</span>&#160;                                     <span class="keywordtype">int</span> bits,</div>
<div class="line"><a name="l00801"></a><span class="lineno">  801</span>&#160;                                     <span class="keywordtype">int</span> value));</div>
<div class="line"><a name="l00802"></a><span class="lineno">  802</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00803"></a><span class="lineno">  803</span>&#160;<span class="comment">     This function inserts bits in the inflate input stream.  The intent is</span></div>
<div class="line"><a name="l00804"></a><span class="lineno">  804</span>&#160;<span class="comment">  that this function is used to start inflating at a bit position in the</span></div>
<div class="line"><a name="l00805"></a><span class="lineno">  805</span>&#160;<span class="comment">  middle of a byte.  The provided bits will be used before any bytes are used</span></div>
<div class="line"><a name="l00806"></a><span class="lineno">  806</span>&#160;<span class="comment">  from next_in.  This function should only be used with raw inflate, and</span></div>
<div class="line"><a name="l00807"></a><span class="lineno">  807</span>&#160;<span class="comment">  should be used before the first inflate() call after inflateInit2() or</span></div>
<div class="line"><a name="l00808"></a><span class="lineno">  808</span>&#160;<span class="comment">  inflateReset().  bits must be less than or equal to 16, and that many of the</span></div>
<div class="line"><a name="l00809"></a><span class="lineno">  809</span>&#160;<span class="comment">  least significant bits of value will be inserted in the input.</span></div>
<div class="line"><a name="l00810"></a><span class="lineno">  810</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00811"></a><span class="lineno">  811</span>&#160;<span class="comment">      inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source</span></div>
<div class="line"><a name="l00812"></a><span class="lineno">  812</span>&#160;<span class="comment">   stream state was inconsistent.</span></div>
<div class="line"><a name="l00813"></a><span class="lineno">  813</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00814"></a><span class="lineno">  814</span>&#160; </div>
<div class="line"><a name="l00815"></a><span class="lineno">  815</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT inflateGetHeader OF((z_streamp strm,</div>
<div class="line"><a name="l00816"></a><span class="lineno">  816</span>&#160;                                         gz_headerp head));</div>
<div class="line"><a name="l00817"></a><span class="lineno">  817</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00818"></a><span class="lineno">  818</span>&#160;<span class="comment">      inflateGetHeader() requests that gzip header information be stored in the</span></div>
<div class="line"><a name="l00819"></a><span class="lineno">  819</span>&#160;<span class="comment">   provided gz_header structure.  inflateGetHeader() may be called after</span></div>
<div class="line"><a name="l00820"></a><span class="lineno">  820</span>&#160;<span class="comment">   inflateInit2() or inflateReset(), and before the first call of inflate().</span></div>
<div class="line"><a name="l00821"></a><span class="lineno">  821</span>&#160;<span class="comment">   As inflate() processes the gzip stream, head-&gt;done is zero until the header</span></div>
<div class="line"><a name="l00822"></a><span class="lineno">  822</span>&#160;<span class="comment">   is completed, at which time head-&gt;done is set to one.  If a zlib stream is</span></div>
<div class="line"><a name="l00823"></a><span class="lineno">  823</span>&#160;<span class="comment">   being decoded, then head-&gt;done is set to -1 to indicate that there will be</span></div>
<div class="line"><a name="l00824"></a><span class="lineno">  824</span>&#160;<span class="comment">   no gzip header information forthcoming.  Note that Z_BLOCK can be used to</span></div>
<div class="line"><a name="l00825"></a><span class="lineno">  825</span>&#160;<span class="comment">   force inflate() to return immediately after header processing is complete</span></div>
<div class="line"><a name="l00826"></a><span class="lineno">  826</span>&#160;<span class="comment">   and before any actual data is decompressed.</span></div>
<div class="line"><a name="l00827"></a><span class="lineno">  827</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00828"></a><span class="lineno">  828</span>&#160;<span class="comment">      The text, time, xflags, and os fields are filled in with the gzip header</span></div>
<div class="line"><a name="l00829"></a><span class="lineno">  829</span>&#160;<span class="comment">   contents.  hcrc is set to true if there is a header CRC.  (The header CRC</span></div>
<div class="line"><a name="l00830"></a><span class="lineno">  830</span>&#160;<span class="comment">   was valid if done is set to one.)  If extra is not Z_NULL, then extra_max</span></div>
<div class="line"><a name="l00831"></a><span class="lineno">  831</span>&#160;<span class="comment">   contains the maximum number of bytes to write to extra.  Once done is true,</span></div>
<div class="line"><a name="l00832"></a><span class="lineno">  832</span>&#160;<span class="comment">   extra_len contains the actual extra field length, and extra contains the</span></div>
<div class="line"><a name="l00833"></a><span class="lineno">  833</span>&#160;<span class="comment">   extra field, or that field truncated if extra_max is less than extra_len.</span></div>
<div class="line"><a name="l00834"></a><span class="lineno">  834</span>&#160;<span class="comment">   If name is not Z_NULL, then up to name_max characters are written there,</span></div>
<div class="line"><a name="l00835"></a><span class="lineno">  835</span>&#160;<span class="comment">   terminated with a zero unless the length is greater than name_max.  If</span></div>
<div class="line"><a name="l00836"></a><span class="lineno">  836</span>&#160;<span class="comment">   comment is not Z_NULL, then up to comm_max characters are written there,</span></div>
<div class="line"><a name="l00837"></a><span class="lineno">  837</span>&#160;<span class="comment">   terminated with a zero unless the length is greater than comm_max.  When</span></div>
<div class="line"><a name="l00838"></a><span class="lineno">  838</span>&#160;<span class="comment">   any of extra, name, or comment are not Z_NULL and the respective field is</span></div>
<div class="line"><a name="l00839"></a><span class="lineno">  839</span>&#160;<span class="comment">   not present in the header, then that field is set to Z_NULL to signal its</span></div>
<div class="line"><a name="l00840"></a><span class="lineno">  840</span>&#160;<span class="comment">   absence.  This allows the use of deflateSetHeader() with the returned</span></div>
<div class="line"><a name="l00841"></a><span class="lineno">  841</span>&#160;<span class="comment">   structure to duplicate the header.  However if those fields are set to</span></div>
<div class="line"><a name="l00842"></a><span class="lineno">  842</span>&#160;<span class="comment">   allocated memory, then the application will need to save those pointers</span></div>
<div class="line"><a name="l00843"></a><span class="lineno">  843</span>&#160;<span class="comment">   elsewhere so that they can be eventually freed.</span></div>
<div class="line"><a name="l00844"></a><span class="lineno">  844</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00845"></a><span class="lineno">  845</span>&#160;<span class="comment">      If inflateGetHeader is not used, then the header information is simply</span></div>
<div class="line"><a name="l00846"></a><span class="lineno">  846</span>&#160;<span class="comment">   discarded.  The header is always checked for validity, including the header</span></div>
<div class="line"><a name="l00847"></a><span class="lineno">  847</span>&#160;<span class="comment">   CRC if present.  inflateReset() will reset the process to discard the header</span></div>
<div class="line"><a name="l00848"></a><span class="lineno">  848</span>&#160;<span class="comment">   information.  The application would need to call inflateGetHeader() again to</span></div>
<div class="line"><a name="l00849"></a><span class="lineno">  849</span>&#160;<span class="comment">   retrieve the header from the next gzip stream.</span></div>
<div class="line"><a name="l00850"></a><span class="lineno">  850</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00851"></a><span class="lineno">  851</span>&#160;<span class="comment">      inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source</span></div>
<div class="line"><a name="l00852"></a><span class="lineno">  852</span>&#160;<span class="comment">   stream state was inconsistent.</span></div>
<div class="line"><a name="l00853"></a><span class="lineno">  853</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00854"></a><span class="lineno">  854</span>&#160; </div>
<div class="line"><a name="l00855"></a><span class="lineno">  855</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00856"></a><span class="lineno">  856</span>&#160;<span class="comment">ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,</span></div>
<div class="line"><a name="l00857"></a><span class="lineno">  857</span>&#160;<span class="comment">                                        unsigned char FAR *window));</span></div>
<div class="line"><a name="l00858"></a><span class="lineno">  858</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00859"></a><span class="lineno">  859</span>&#160;<span class="comment">     Initialize the internal stream state for decompression using inflateBack()</span></div>
<div class="line"><a name="l00860"></a><span class="lineno">  860</span>&#160;<span class="comment">   calls.  The fields zalloc, zfree and opaque in strm must be initialized</span></div>
<div class="line"><a name="l00861"></a><span class="lineno">  861</span>&#160;<span class="comment">   before the call.  If zalloc and zfree are Z_NULL, then the default library-</span></div>
<div class="line"><a name="l00862"></a><span class="lineno">  862</span>&#160;<span class="comment">   derived memory allocation routines are used.  windowBits is the base two</span></div>
<div class="line"><a name="l00863"></a><span class="lineno">  863</span>&#160;<span class="comment">   logarithm of the window size, in the range 8..15.  window is a caller</span></div>
<div class="line"><a name="l00864"></a><span class="lineno">  864</span>&#160;<span class="comment">   supplied buffer of that size.  Except for special applications where it is</span></div>
<div class="line"><a name="l00865"></a><span class="lineno">  865</span>&#160;<span class="comment">   assured that deflate was used with small window sizes, windowBits must be 15</span></div>
<div class="line"><a name="l00866"></a><span class="lineno">  866</span>&#160;<span class="comment">   and a 32K byte window must be supplied to be able to decompress general</span></div>
<div class="line"><a name="l00867"></a><span class="lineno">  867</span>&#160;<span class="comment">   deflate streams.</span></div>
<div class="line"><a name="l00868"></a><span class="lineno">  868</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00869"></a><span class="lineno">  869</span>&#160;<span class="comment">     See inflateBack() for the usage of these routines.</span></div>
<div class="line"><a name="l00870"></a><span class="lineno">  870</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00871"></a><span class="lineno">  871</span>&#160;<span class="comment">     inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of</span></div>
<div class="line"><a name="l00872"></a><span class="lineno">  872</span>&#160;<span class="comment">   the paramaters are invalid, Z_MEM_ERROR if the internal state could not</span></div>
<div class="line"><a name="l00873"></a><span class="lineno">  873</span>&#160;<span class="comment">   be allocated, or Z_VERSION_ERROR if the version of the library does not</span></div>
<div class="line"><a name="l00874"></a><span class="lineno">  874</span>&#160;<span class="comment">   match the version of the header file.</span></div>
<div class="line"><a name="l00875"></a><span class="lineno">  875</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00876"></a><span class="lineno">  876</span>&#160; </div>
<div class="line"><a name="l00877"></a><span class="lineno">  877</span>&#160;<span class="keyword">typedef</span> unsigned (*in_func) OF((<span class="keywordtype">void</span> FAR *, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> FAR * FAR *));</div>
<div class="line"><a name="l00878"></a><span class="lineno">  878</span>&#160;<span class="keyword">typedef</span> int (*out_func) OF((<span class="keywordtype">void</span> FAR *, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> FAR *, <span class="keywordtype">unsigned</span>));</div>
<div class="line"><a name="l00879"></a><span class="lineno">  879</span>&#160; </div>
<div class="line"><a name="l00880"></a><span class="lineno">  880</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT inflateBack OF((z_streamp strm,</div>
<div class="line"><a name="l00881"></a><span class="lineno">  881</span>&#160;                                    in_func in, <span class="keywordtype">void</span> FAR *in_desc,</div>
<div class="line"><a name="l00882"></a><span class="lineno">  882</span>&#160;                                    out_func out, <span class="keywordtype">void</span> FAR *out_desc));</div>
<div class="line"><a name="l00883"></a><span class="lineno">  883</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00884"></a><span class="lineno">  884</span>&#160;<span class="comment">     inflateBack() does a raw inflate with a single call using a call-back</span></div>
<div class="line"><a name="l00885"></a><span class="lineno">  885</span>&#160;<span class="comment">   interface for input and output.  This is more efficient than inflate() for</span></div>
<div class="line"><a name="l00886"></a><span class="lineno">  886</span>&#160;<span class="comment">   file i/o applications in that it avoids copying between the output and the</span></div>
<div class="line"><a name="l00887"></a><span class="lineno">  887</span>&#160;<span class="comment">   sliding window by simply making the window itself the output buffer.  This</span></div>
<div class="line"><a name="l00888"></a><span class="lineno">  888</span>&#160;<span class="comment">   function trusts the application to not change the output buffer passed by</span></div>
<div class="line"><a name="l00889"></a><span class="lineno">  889</span>&#160;<span class="comment">   the output function, at least until inflateBack() returns.</span></div>
<div class="line"><a name="l00890"></a><span class="lineno">  890</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00891"></a><span class="lineno">  891</span>&#160;<span class="comment">     inflateBackInit() must be called first to allocate the internal state</span></div>
<div class="line"><a name="l00892"></a><span class="lineno">  892</span>&#160;<span class="comment">   and to initialize the state with the user-provided window buffer.</span></div>
<div class="line"><a name="l00893"></a><span class="lineno">  893</span>&#160;<span class="comment">   inflateBack() may then be used multiple times to inflate a complete, raw</span></div>
<div class="line"><a name="l00894"></a><span class="lineno">  894</span>&#160;<span class="comment">   deflate stream with each call.  inflateBackEnd() is then called to free</span></div>
<div class="line"><a name="l00895"></a><span class="lineno">  895</span>&#160;<span class="comment">   the allocated state.</span></div>
<div class="line"><a name="l00896"></a><span class="lineno">  896</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00897"></a><span class="lineno">  897</span>&#160;<span class="comment">     A raw deflate stream is one with no zlib or gzip header or trailer.</span></div>
<div class="line"><a name="l00898"></a><span class="lineno">  898</span>&#160;<span class="comment">   This routine would normally be used in a utility that reads zip or gzip</span></div>
<div class="line"><a name="l00899"></a><span class="lineno">  899</span>&#160;<span class="comment">   files and writes out uncompressed files.  The utility would decode the</span></div>
<div class="line"><a name="l00900"></a><span class="lineno">  900</span>&#160;<span class="comment">   header and process the trailer on its own, hence this routine expects</span></div>
<div class="line"><a name="l00901"></a><span class="lineno">  901</span>&#160;<span class="comment">   only the raw deflate stream to decompress.  This is different from the</span></div>
<div class="line"><a name="l00902"></a><span class="lineno">  902</span>&#160;<span class="comment">   normal behavior of inflate(), which expects either a zlib or gzip header and</span></div>
<div class="line"><a name="l00903"></a><span class="lineno">  903</span>&#160;<span class="comment">   trailer around the deflate stream.</span></div>
<div class="line"><a name="l00904"></a><span class="lineno">  904</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00905"></a><span class="lineno">  905</span>&#160;<span class="comment">     inflateBack() uses two subroutines supplied by the caller that are then</span></div>
<div class="line"><a name="l00906"></a><span class="lineno">  906</span>&#160;<span class="comment">   called by inflateBack() for input and output.  inflateBack() calls those</span></div>
<div class="line"><a name="l00907"></a><span class="lineno">  907</span>&#160;<span class="comment">   routines until it reads a complete deflate stream and writes out all of the</span></div>
<div class="line"><a name="l00908"></a><span class="lineno">  908</span>&#160;<span class="comment">   uncompressed data, or until it encounters an error.  The function&#39;s</span></div>
<div class="line"><a name="l00909"></a><span class="lineno">  909</span>&#160;<span class="comment">   parameters and return types are defined above in the in_func and out_func</span></div>
<div class="line"><a name="l00910"></a><span class="lineno">  910</span>&#160;<span class="comment">   typedefs.  inflateBack() will call in(in_desc, &amp;buf) which should return the</span></div>
<div class="line"><a name="l00911"></a><span class="lineno">  911</span>&#160;<span class="comment">   number of bytes of provided input, and a pointer to that input in buf.  If</span></div>
<div class="line"><a name="l00912"></a><span class="lineno">  912</span>&#160;<span class="comment">   there is no input available, in() must return zero--buf is ignored in that</span></div>
<div class="line"><a name="l00913"></a><span class="lineno">  913</span>&#160;<span class="comment">   case--and inflateBack() will return a buffer error.  inflateBack() will call</span></div>
<div class="line"><a name="l00914"></a><span class="lineno">  914</span>&#160;<span class="comment">   out(out_desc, buf, len) to write the uncompressed data buf[0..len-1].  out()</span></div>
<div class="line"><a name="l00915"></a><span class="lineno">  915</span>&#160;<span class="comment">   should return zero on success, or non-zero on failure.  If out() returns</span></div>
<div class="line"><a name="l00916"></a><span class="lineno">  916</span>&#160;<span class="comment">   non-zero, inflateBack() will return with an error.  Neither in() nor out()</span></div>
<div class="line"><a name="l00917"></a><span class="lineno">  917</span>&#160;<span class="comment">   are permitted to change the contents of the window provided to</span></div>
<div class="line"><a name="l00918"></a><span class="lineno">  918</span>&#160;<span class="comment">   inflateBackInit(), which is also the buffer that out() uses to write from.</span></div>
<div class="line"><a name="l00919"></a><span class="lineno">  919</span>&#160;<span class="comment">   The length written by out() will be at most the window size.  Any non-zero</span></div>
<div class="line"><a name="l00920"></a><span class="lineno">  920</span>&#160;<span class="comment">   amount of input may be provided by in().</span></div>
<div class="line"><a name="l00921"></a><span class="lineno">  921</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00922"></a><span class="lineno">  922</span>&#160;<span class="comment">     For convenience, inflateBack() can be provided input on the first call by</span></div>
<div class="line"><a name="l00923"></a><span class="lineno">  923</span>&#160;<span class="comment">   setting strm-&gt;next_in and strm-&gt;avail_in.  If that input is exhausted, then</span></div>
<div class="line"><a name="l00924"></a><span class="lineno">  924</span>&#160;<span class="comment">   in() will be called.  Therefore strm-&gt;next_in must be initialized before</span></div>
<div class="line"><a name="l00925"></a><span class="lineno">  925</span>&#160;<span class="comment">   calling inflateBack().  If strm-&gt;next_in is Z_NULL, then in() will be called</span></div>
<div class="line"><a name="l00926"></a><span class="lineno">  926</span>&#160;<span class="comment">   immediately for input.  If strm-&gt;next_in is not Z_NULL, then strm-&gt;avail_in</span></div>
<div class="line"><a name="l00927"></a><span class="lineno">  927</span>&#160;<span class="comment">   must also be initialized, and then if strm-&gt;avail_in is not zero, input will</span></div>
<div class="line"><a name="l00928"></a><span class="lineno">  928</span>&#160;<span class="comment">   initially be taken from strm-&gt;next_in[0 .. strm-&gt;avail_in - 1].</span></div>
<div class="line"><a name="l00929"></a><span class="lineno">  929</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00930"></a><span class="lineno">  930</span>&#160;<span class="comment">     The in_desc and out_desc parameters of inflateBack() is passed as the</span></div>
<div class="line"><a name="l00931"></a><span class="lineno">  931</span>&#160;<span class="comment">   first parameter of in() and out() respectively when they are called.  These</span></div>
<div class="line"><a name="l00932"></a><span class="lineno">  932</span>&#160;<span class="comment">   descriptors can be optionally used to pass any information that the caller-</span></div>
<div class="line"><a name="l00933"></a><span class="lineno">  933</span>&#160;<span class="comment">   supplied in() and out() functions need to do their job.</span></div>
<div class="line"><a name="l00934"></a><span class="lineno">  934</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00935"></a><span class="lineno">  935</span>&#160;<span class="comment">     On return, inflateBack() will set strm-&gt;next_in and strm-&gt;avail_in to</span></div>
<div class="line"><a name="l00936"></a><span class="lineno">  936</span>&#160;<span class="comment">   pass back any unused input that was provided by the last in() call.  The</span></div>
<div class="line"><a name="l00937"></a><span class="lineno">  937</span>&#160;<span class="comment">   return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR</span></div>
<div class="line"><a name="l00938"></a><span class="lineno">  938</span>&#160;<span class="comment">   if in() or out() returned an error, Z_DATA_ERROR if there was a format</span></div>
<div class="line"><a name="l00939"></a><span class="lineno">  939</span>&#160;<span class="comment">   error in the deflate stream (in which case strm-&gt;msg is set to indicate the</span></div>
<div class="line"><a name="l00940"></a><span class="lineno">  940</span>&#160;<span class="comment">   nature of the error), or Z_STREAM_ERROR if the stream was not properly</span></div>
<div class="line"><a name="l00941"></a><span class="lineno">  941</span>&#160;<span class="comment">   initialized.  In the case of Z_BUF_ERROR, an input or output error can be</span></div>
<div class="line"><a name="l00942"></a><span class="lineno">  942</span>&#160;<span class="comment">   distinguished using strm-&gt;next_in which will be Z_NULL only if in() returned</span></div>
<div class="line"><a name="l00943"></a><span class="lineno">  943</span>&#160;<span class="comment">   an error.  If strm-&gt;next is not Z_NULL, then the Z_BUF_ERROR was due to</span></div>
<div class="line"><a name="l00944"></a><span class="lineno">  944</span>&#160;<span class="comment">   out() returning non-zero.  (in() will always be called before out(), so</span></div>
<div class="line"><a name="l00945"></a><span class="lineno">  945</span>&#160;<span class="comment">   strm-&gt;next_in is assured to be defined if out() returns non-zero.)  Note</span></div>
<div class="line"><a name="l00946"></a><span class="lineno">  946</span>&#160;<span class="comment">   that inflateBack() cannot return Z_OK.</span></div>
<div class="line"><a name="l00947"></a><span class="lineno">  947</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00948"></a><span class="lineno">  948</span>&#160; </div>
<div class="line"><a name="l00949"></a><span class="lineno">  949</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT inflateBackEnd OF((z_streamp strm));</div>
<div class="line"><a name="l00950"></a><span class="lineno">  950</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00951"></a><span class="lineno">  951</span>&#160;<span class="comment">     All memory allocated by inflateBackInit() is freed.</span></div>
<div class="line"><a name="l00952"></a><span class="lineno">  952</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00953"></a><span class="lineno">  953</span>&#160;<span class="comment">     inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream</span></div>
<div class="line"><a name="l00954"></a><span class="lineno">  954</span>&#160;<span class="comment">   state was inconsistent.</span></div>
<div class="line"><a name="l00955"></a><span class="lineno">  955</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00956"></a><span class="lineno">  956</span>&#160; </div>
<div class="line"><a name="l00957"></a><span class="lineno">  957</span>&#160;ZEXTERN uLong ZEXPORT zlibCompileFlags OF((<span class="keywordtype">void</span>));</div>
<div class="line"><a name="l00958"></a><span class="lineno">  958</span>&#160;<span class="comment">/* Return flags indicating compile-time options.</span></div>
<div class="line"><a name="l00959"></a><span class="lineno">  959</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00960"></a><span class="lineno">  960</span>&#160;<span class="comment">    Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:</span></div>
<div class="line"><a name="l00961"></a><span class="lineno">  961</span>&#160;<span class="comment">     1.0: size of uInt</span></div>
<div class="line"><a name="l00962"></a><span class="lineno">  962</span>&#160;<span class="comment">     3.2: size of uLong</span></div>
<div class="line"><a name="l00963"></a><span class="lineno">  963</span>&#160;<span class="comment">     5.4: size of voidpf (pointer)</span></div>
<div class="line"><a name="l00964"></a><span class="lineno">  964</span>&#160;<span class="comment">     7.6: size of z_off_t</span></div>
<div class="line"><a name="l00965"></a><span class="lineno">  965</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00966"></a><span class="lineno">  966</span>&#160;<span class="comment">    Compiler, assembler, and debug options:</span></div>
<div class="line"><a name="l00967"></a><span class="lineno">  967</span>&#160;<span class="comment">     8: DEBUG</span></div>
<div class="line"><a name="l00968"></a><span class="lineno">  968</span>&#160;<span class="comment">     9: ASMV or ASMINF -- use ASM code</span></div>
<div class="line"><a name="l00969"></a><span class="lineno">  969</span>&#160;<span class="comment">     10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention</span></div>
<div class="line"><a name="l00970"></a><span class="lineno">  970</span>&#160;<span class="comment">     11: 0 (reserved)</span></div>
<div class="line"><a name="l00971"></a><span class="lineno">  971</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00972"></a><span class="lineno">  972</span>&#160;<span class="comment">    One-time table building (smaller code, but not thread-safe if true):</span></div>
<div class="line"><a name="l00973"></a><span class="lineno">  973</span>&#160;<span class="comment">     12: BUILDFIXED -- build static block decoding tables when needed</span></div>
<div class="line"><a name="l00974"></a><span class="lineno">  974</span>&#160;<span class="comment">     13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed</span></div>
<div class="line"><a name="l00975"></a><span class="lineno">  975</span>&#160;<span class="comment">     14,15: 0 (reserved)</span></div>
<div class="line"><a name="l00976"></a><span class="lineno">  976</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00977"></a><span class="lineno">  977</span>&#160;<span class="comment">    Library content (indicates missing functionality):</span></div>
<div class="line"><a name="l00978"></a><span class="lineno">  978</span>&#160;<span class="comment">     16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking</span></div>
<div class="line"><a name="l00979"></a><span class="lineno">  979</span>&#160;<span class="comment">                          deflate code when not needed)</span></div>
<div class="line"><a name="l00980"></a><span class="lineno">  980</span>&#160;<span class="comment">     17: NO_GZIP -- deflate can&#39;t write gzip streams, and inflate can&#39;t detect</span></div>
<div class="line"><a name="l00981"></a><span class="lineno">  981</span>&#160;<span class="comment">                    and decode gzip streams (to avoid linking crc code)</span></div>
<div class="line"><a name="l00982"></a><span class="lineno">  982</span>&#160;<span class="comment">     18-19: 0 (reserved)</span></div>
<div class="line"><a name="l00983"></a><span class="lineno">  983</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00984"></a><span class="lineno">  984</span>&#160;<span class="comment">    Operation variations (changes in library functionality):</span></div>
<div class="line"><a name="l00985"></a><span class="lineno">  985</span>&#160;<span class="comment">     20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate</span></div>
<div class="line"><a name="l00986"></a><span class="lineno">  986</span>&#160;<span class="comment">     21: FASTEST -- deflate algorithm with only one, lowest compression level</span></div>
<div class="line"><a name="l00987"></a><span class="lineno">  987</span>&#160;<span class="comment">     22,23: 0 (reserved)</span></div>
<div class="line"><a name="l00988"></a><span class="lineno">  988</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00989"></a><span class="lineno">  989</span>&#160;<span class="comment">    The sprintf variant used by gzprintf (zero is best):</span></div>
<div class="line"><a name="l00990"></a><span class="lineno">  990</span>&#160;<span class="comment">     24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format</span></div>
<div class="line"><a name="l00991"></a><span class="lineno">  991</span>&#160;<span class="comment">     25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!</span></div>
<div class="line"><a name="l00992"></a><span class="lineno">  992</span>&#160;<span class="comment">     26: 0 = returns value, 1 = void -- 1 means inferred string length returned</span></div>
<div class="line"><a name="l00993"></a><span class="lineno">  993</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00994"></a><span class="lineno">  994</span>&#160;<span class="comment">    Remainder:</span></div>
<div class="line"><a name="l00995"></a><span class="lineno">  995</span>&#160;<span class="comment">     27-31: 0 (reserved)</span></div>
<div class="line"><a name="l00996"></a><span class="lineno">  996</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00997"></a><span class="lineno">  997</span>&#160; </div>
<div class="line"><a name="l00998"></a><span class="lineno">  998</span>&#160; </div>
<div class="line"><a name="l00999"></a><span class="lineno">  999</span>&#160;                        <span class="comment">/* utility functions */</span></div>
<div class="line"><a name="l01000"></a><span class="lineno"> 1000</span>&#160; </div>
<div class="line"><a name="l01001"></a><span class="lineno"> 1001</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01002"></a><span class="lineno"> 1002</span>&#160;<span class="comment">     The following utility functions are implemented on top of the</span></div>
<div class="line"><a name="l01003"></a><span class="lineno"> 1003</span>&#160;<span class="comment">   basic stream-oriented functions. To simplify the interface, some</span></div>
<div class="line"><a name="l01004"></a><span class="lineno"> 1004</span>&#160;<span class="comment">   default options are assumed (compression level and memory usage,</span></div>
<div class="line"><a name="l01005"></a><span class="lineno"> 1005</span>&#160;<span class="comment">   standard memory allocation functions). The source code of these</span></div>
<div class="line"><a name="l01006"></a><span class="lineno"> 1006</span>&#160;<span class="comment">   utility functions can easily be modified if you need special options.</span></div>
<div class="line"><a name="l01007"></a><span class="lineno"> 1007</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01008"></a><span class="lineno"> 1008</span>&#160; </div>
<div class="line"><a name="l01009"></a><span class="lineno"> 1009</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT compress OF((Bytef *dest,   uLongf *destLen,</div>
<div class="line"><a name="l01010"></a><span class="lineno"> 1010</span>&#160;                                 <span class="keyword">const</span> Bytef *source, uLong sourceLen));</div>
<div class="line"><a name="l01011"></a><span class="lineno"> 1011</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01012"></a><span class="lineno"> 1012</span>&#160;<span class="comment">     Compresses the source buffer into the destination buffer.  sourceLen is</span></div>
<div class="line"><a name="l01013"></a><span class="lineno"> 1013</span>&#160;<span class="comment">   the byte length of the source buffer. Upon entry, destLen is the total</span></div>
<div class="line"><a name="l01014"></a><span class="lineno"> 1014</span>&#160;<span class="comment">   size of the destination buffer, which must be at least the value returned</span></div>
<div class="line"><a name="l01015"></a><span class="lineno"> 1015</span>&#160;<span class="comment">   by compressBound(sourceLen). Upon exit, destLen is the actual size of the</span></div>
<div class="line"><a name="l01016"></a><span class="lineno"> 1016</span>&#160;<span class="comment">   compressed buffer.</span></div>
<div class="line"><a name="l01017"></a><span class="lineno"> 1017</span>&#160;<span class="comment">     This function can be used to compress a whole file at once if the</span></div>
<div class="line"><a name="l01018"></a><span class="lineno"> 1018</span>&#160;<span class="comment">   input file is mmap&#39;ed.</span></div>
<div class="line"><a name="l01019"></a><span class="lineno"> 1019</span>&#160;<span class="comment">     compress returns Z_OK if success, Z_MEM_ERROR if there was not</span></div>
<div class="line"><a name="l01020"></a><span class="lineno"> 1020</span>&#160;<span class="comment">   enough memory, Z_BUF_ERROR if there was not enough room in the output</span></div>
<div class="line"><a name="l01021"></a><span class="lineno"> 1021</span>&#160;<span class="comment">   buffer.</span></div>
<div class="line"><a name="l01022"></a><span class="lineno"> 1022</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01023"></a><span class="lineno"> 1023</span>&#160; </div>
<div class="line"><a name="l01024"></a><span class="lineno"> 1024</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT compress2 OF((Bytef *dest,   uLongf *destLen,</div>
<div class="line"><a name="l01025"></a><span class="lineno"> 1025</span>&#160;                                  <span class="keyword">const</span> Bytef *source, uLong sourceLen,</div>
<div class="line"><a name="l01026"></a><span class="lineno"> 1026</span>&#160;                                  <span class="keywordtype">int</span> level));</div>
<div class="line"><a name="l01027"></a><span class="lineno"> 1027</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01028"></a><span class="lineno"> 1028</span>&#160;<span class="comment">     Compresses the source buffer into the destination buffer. The level</span></div>
<div class="line"><a name="l01029"></a><span class="lineno"> 1029</span>&#160;<span class="comment">   parameter has the same meaning as in deflateInit.  sourceLen is the byte</span></div>
<div class="line"><a name="l01030"></a><span class="lineno"> 1030</span>&#160;<span class="comment">   length of the source buffer. Upon entry, destLen is the total size of the</span></div>
<div class="line"><a name="l01031"></a><span class="lineno"> 1031</span>&#160;<span class="comment">   destination buffer, which must be at least the value returned by</span></div>
<div class="line"><a name="l01032"></a><span class="lineno"> 1032</span>&#160;<span class="comment">   compressBound(sourceLen). Upon exit, destLen is the actual size of the</span></div>
<div class="line"><a name="l01033"></a><span class="lineno"> 1033</span>&#160;<span class="comment">   compressed buffer.</span></div>
<div class="line"><a name="l01034"></a><span class="lineno"> 1034</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l01035"></a><span class="lineno"> 1035</span>&#160;<span class="comment">     compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough</span></div>
<div class="line"><a name="l01036"></a><span class="lineno"> 1036</span>&#160;<span class="comment">   memory, Z_BUF_ERROR if there was not enough room in the output buffer,</span></div>
<div class="line"><a name="l01037"></a><span class="lineno"> 1037</span>&#160;<span class="comment">   Z_STREAM_ERROR if the level parameter is invalid.</span></div>
<div class="line"><a name="l01038"></a><span class="lineno"> 1038</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01039"></a><span class="lineno"> 1039</span>&#160; </div>
<div class="line"><a name="l01040"></a><span class="lineno"> 1040</span>&#160;ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));</div>
<div class="line"><a name="l01041"></a><span class="lineno"> 1041</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01042"></a><span class="lineno"> 1042</span>&#160;<span class="comment">     compressBound() returns an upper bound on the compressed size after</span></div>
<div class="line"><a name="l01043"></a><span class="lineno"> 1043</span>&#160;<span class="comment">   compress() or compress2() on sourceLen bytes.  It would be used before</span></div>
<div class="line"><a name="l01044"></a><span class="lineno"> 1044</span>&#160;<span class="comment">   a compress() or compress2() call to allocate the destination buffer.</span></div>
<div class="line"><a name="l01045"></a><span class="lineno"> 1045</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01046"></a><span class="lineno"> 1046</span>&#160; </div>
<div class="line"><a name="l01047"></a><span class="lineno"> 1047</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT uncompress OF((Bytef *dest,   uLongf *destLen,</div>
<div class="line"><a name="l01048"></a><span class="lineno"> 1048</span>&#160;                                   <span class="keyword">const</span> Bytef *source, uLong sourceLen));</div>
<div class="line"><a name="l01049"></a><span class="lineno"> 1049</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01050"></a><span class="lineno"> 1050</span>&#160;<span class="comment">     Decompresses the source buffer into the destination buffer.  sourceLen is</span></div>
<div class="line"><a name="l01051"></a><span class="lineno"> 1051</span>&#160;<span class="comment">   the byte length of the source buffer. Upon entry, destLen is the total</span></div>
<div class="line"><a name="l01052"></a><span class="lineno"> 1052</span>&#160;<span class="comment">   size of the destination buffer, which must be large enough to hold the</span></div>
<div class="line"><a name="l01053"></a><span class="lineno"> 1053</span>&#160;<span class="comment">   entire uncompressed data. (The size of the uncompressed data must have</span></div>
<div class="line"><a name="l01054"></a><span class="lineno"> 1054</span>&#160;<span class="comment">   been saved previously by the compressor and transmitted to the decompressor</span></div>
<div class="line"><a name="l01055"></a><span class="lineno"> 1055</span>&#160;<span class="comment">   by some mechanism outside the scope of this compression library.)</span></div>
<div class="line"><a name="l01056"></a><span class="lineno"> 1056</span>&#160;<span class="comment">   Upon exit, destLen is the actual size of the compressed buffer.</span></div>
<div class="line"><a name="l01057"></a><span class="lineno"> 1057</span>&#160;<span class="comment">     This function can be used to decompress a whole file at once if the</span></div>
<div class="line"><a name="l01058"></a><span class="lineno"> 1058</span>&#160;<span class="comment">   input file is mmap&#39;ed.</span></div>
<div class="line"><a name="l01059"></a><span class="lineno"> 1059</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l01060"></a><span class="lineno"> 1060</span>&#160;<span class="comment">     uncompress returns Z_OK if success, Z_MEM_ERROR if there was not</span></div>
<div class="line"><a name="l01061"></a><span class="lineno"> 1061</span>&#160;<span class="comment">   enough memory, Z_BUF_ERROR if there was not enough room in the output</span></div>
<div class="line"><a name="l01062"></a><span class="lineno"> 1062</span>&#160;<span class="comment">   buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.</span></div>
<div class="line"><a name="l01063"></a><span class="lineno"> 1063</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01064"></a><span class="lineno"> 1064</span>&#160; </div>
<div class="line"><a name="l01065"></a><span class="lineno"> 1065</span>&#160; </div>
<div class="line"><a name="l01066"></a><span class="lineno"> 1066</span>&#160;<span class="keyword">typedef</span> voidp gzFile;</div>
<div class="line"><a name="l01067"></a><span class="lineno"> 1067</span>&#160; </div>
<div class="line"><a name="l01068"></a><span class="lineno"> 1068</span>&#160;ZEXTERN gzFile ZEXPORT gzopen  OF((<span class="keyword">const</span> <span class="keywordtype">char</span> *path, <span class="keyword">const</span> <span class="keywordtype">char</span> *mode));</div>
<div class="line"><a name="l01069"></a><span class="lineno"> 1069</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01070"></a><span class="lineno"> 1070</span>&#160;<span class="comment">     Opens a gzip (.gz) file for reading or writing. The mode parameter</span></div>
<div class="line"><a name="l01071"></a><span class="lineno"> 1071</span>&#160;<span class="comment">   is as in fopen (&quot;rb&quot; or &quot;wb&quot;) but can also include a compression level</span></div>
<div class="line"><a name="l01072"></a><span class="lineno"> 1072</span>&#160;<span class="comment">   (&quot;wb9&quot;) or a strategy: &#39;f&#39; for filtered data as in &quot;wb6f&quot;, &#39;h&#39; for</span></div>
<div class="line"><a name="l01073"></a><span class="lineno"> 1073</span>&#160;<span class="comment">   Huffman only compression as in &quot;wb1h&quot;, or &#39;R&#39; for run-length encoding</span></div>
<div class="line"><a name="l01074"></a><span class="lineno"> 1074</span>&#160;<span class="comment">   as in &quot;wb1R&quot;. (See the description of deflateInit2 for more information</span></div>
<div class="line"><a name="l01075"></a><span class="lineno"> 1075</span>&#160;<span class="comment">   about the strategy parameter.)</span></div>
<div class="line"><a name="l01076"></a><span class="lineno"> 1076</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l01077"></a><span class="lineno"> 1077</span>&#160;<span class="comment">     gzopen can be used to read a file which is not in gzip format; in this</span></div>
<div class="line"><a name="l01078"></a><span class="lineno"> 1078</span>&#160;<span class="comment">   case gzread will directly read from the file without decompression.</span></div>
<div class="line"><a name="l01079"></a><span class="lineno"> 1079</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l01080"></a><span class="lineno"> 1080</span>&#160;<span class="comment">     gzopen returns NULL if the file could not be opened or if there was</span></div>
<div class="line"><a name="l01081"></a><span class="lineno"> 1081</span>&#160;<span class="comment">   insufficient memory to allocate the (de)compression state; errno</span></div>
<div class="line"><a name="l01082"></a><span class="lineno"> 1082</span>&#160;<span class="comment">   can be checked to distinguish the two cases (if errno is zero, the</span></div>
<div class="line"><a name="l01083"></a><span class="lineno"> 1083</span>&#160;<span class="comment">   zlib error is Z_MEM_ERROR).  */</span></div>
<div class="line"><a name="l01084"></a><span class="lineno"> 1084</span>&#160; </div>
<div class="line"><a name="l01085"></a><span class="lineno"> 1085</span>&#160;ZEXTERN gzFile ZEXPORT gzdopen  OF((<span class="keywordtype">int</span> fd, <span class="keyword">const</span> <span class="keywordtype">char</span> *mode));</div>
<div class="line"><a name="l01086"></a><span class="lineno"> 1086</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01087"></a><span class="lineno"> 1087</span>&#160;<span class="comment">     gzdopen() associates a gzFile with the file descriptor fd.  File</span></div>
<div class="line"><a name="l01088"></a><span class="lineno"> 1088</span>&#160;<span class="comment">   descriptors are obtained from calls like open, dup, creat, pipe or</span></div>
<div class="line"><a name="l01089"></a><span class="lineno"> 1089</span>&#160;<span class="comment">   fileno (in the file has been previously opened with fopen).</span></div>
<div class="line"><a name="l01090"></a><span class="lineno"> 1090</span>&#160;<span class="comment">   The mode parameter is as in gzopen.</span></div>
<div class="line"><a name="l01091"></a><span class="lineno"> 1091</span>&#160;<span class="comment">     The next call of gzclose on the returned gzFile will also close the</span></div>
<div class="line"><a name="l01092"></a><span class="lineno"> 1092</span>&#160;<span class="comment">   file descriptor fd, just like fclose(fdopen(fd), mode) closes the file</span></div>
<div class="line"><a name="l01093"></a><span class="lineno"> 1093</span>&#160;<span class="comment">   descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).</span></div>
<div class="line"><a name="l01094"></a><span class="lineno"> 1094</span>&#160;<span class="comment">     gzdopen returns NULL if there was insufficient memory to allocate</span></div>
<div class="line"><a name="l01095"></a><span class="lineno"> 1095</span>&#160;<span class="comment">   the (de)compression state.</span></div>
<div class="line"><a name="l01096"></a><span class="lineno"> 1096</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01097"></a><span class="lineno"> 1097</span>&#160; </div>
<div class="line"><a name="l01098"></a><span class="lineno"> 1098</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT gzsetparams OF((gzFile file, <span class="keywordtype">int</span> level, <span class="keywordtype">int</span> strategy));</div>
<div class="line"><a name="l01099"></a><span class="lineno"> 1099</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01100"></a><span class="lineno"> 1100</span>&#160;<span class="comment">     Dynamically update the compression level or strategy. See the description</span></div>
<div class="line"><a name="l01101"></a><span class="lineno"> 1101</span>&#160;<span class="comment">   of deflateInit2 for the meaning of these parameters.</span></div>
<div class="line"><a name="l01102"></a><span class="lineno"> 1102</span>&#160;<span class="comment">     gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not</span></div>
<div class="line"><a name="l01103"></a><span class="lineno"> 1103</span>&#160;<span class="comment">   opened for writing.</span></div>
<div class="line"><a name="l01104"></a><span class="lineno"> 1104</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01105"></a><span class="lineno"> 1105</span>&#160; </div>
<div class="line"><a name="l01106"></a><span class="lineno"> 1106</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT    gzread  OF((gzFile file, voidp buf, <span class="keywordtype">unsigned</span> len));</div>
<div class="line"><a name="l01107"></a><span class="lineno"> 1107</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01108"></a><span class="lineno"> 1108</span>&#160;<span class="comment">     Reads the given number of uncompressed bytes from the compressed file.</span></div>
<div class="line"><a name="l01109"></a><span class="lineno"> 1109</span>&#160;<span class="comment">   If the input file was not in gzip format, gzread copies the given number</span></div>
<div class="line"><a name="l01110"></a><span class="lineno"> 1110</span>&#160;<span class="comment">   of bytes into the buffer.</span></div>
<div class="line"><a name="l01111"></a><span class="lineno"> 1111</span>&#160;<span class="comment">     gzread returns the number of uncompressed bytes actually read (0 for</span></div>
<div class="line"><a name="l01112"></a><span class="lineno"> 1112</span>&#160;<span class="comment">   end of file, -1 for error). */</span></div>
<div class="line"><a name="l01113"></a><span class="lineno"> 1113</span>&#160; </div>
<div class="line"><a name="l01114"></a><span class="lineno"> 1114</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT    gzwrite OF((gzFile file,</div>
<div class="line"><a name="l01115"></a><span class="lineno"> 1115</span>&#160;                                   voidpc buf, <span class="keywordtype">unsigned</span> len));</div>
<div class="line"><a name="l01116"></a><span class="lineno"> 1116</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01117"></a><span class="lineno"> 1117</span>&#160;<span class="comment">     Writes the given number of uncompressed bytes into the compressed file.</span></div>
<div class="line"><a name="l01118"></a><span class="lineno"> 1118</span>&#160;<span class="comment">   gzwrite returns the number of uncompressed bytes actually written</span></div>
<div class="line"><a name="l01119"></a><span class="lineno"> 1119</span>&#160;<span class="comment">   (0 in case of error).</span></div>
<div class="line"><a name="l01120"></a><span class="lineno"> 1120</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01121"></a><span class="lineno"> 1121</span>&#160; </div>
<div class="line"><a name="l01122"></a><span class="lineno"> 1122</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORTVA   gzprintf OF((gzFile file, <span class="keyword">const</span> <span class="keywordtype">char</span> *format, ...));</div>
<div class="line"><a name="l01123"></a><span class="lineno"> 1123</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01124"></a><span class="lineno"> 1124</span>&#160;<span class="comment">     Converts, formats, and writes the args to the compressed file under</span></div>
<div class="line"><a name="l01125"></a><span class="lineno"> 1125</span>&#160;<span class="comment">   control of the format string, as in fprintf. gzprintf returns the number of</span></div>
<div class="line"><a name="l01126"></a><span class="lineno"> 1126</span>&#160;<span class="comment">   uncompressed bytes actually written (0 in case of error).  The number of</span></div>
<div class="line"><a name="l01127"></a><span class="lineno"> 1127</span>&#160;<span class="comment">   uncompressed bytes written is limited to 4095. The caller should assure that</span></div>
<div class="line"><a name="l01128"></a><span class="lineno"> 1128</span>&#160;<span class="comment">   this limit is not exceeded. If it is exceeded, then gzprintf() will return</span></div>
<div class="line"><a name="l01129"></a><span class="lineno"> 1129</span>&#160;<span class="comment">   return an error (0) with nothing written. In this case, there may also be a</span></div>
<div class="line"><a name="l01130"></a><span class="lineno"> 1130</span>&#160;<span class="comment">   buffer overflow with unpredictable consequences, which is possible only if</span></div>
<div class="line"><a name="l01131"></a><span class="lineno"> 1131</span>&#160;<span class="comment">   zlib was compiled with the insecure functions sprintf() or vsprintf()</span></div>
<div class="line"><a name="l01132"></a><span class="lineno"> 1132</span>&#160;<span class="comment">   because the secure snprintf() or vsnprintf() functions were not available.</span></div>
<div class="line"><a name="l01133"></a><span class="lineno"> 1133</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01134"></a><span class="lineno"> 1134</span>&#160; </div>
<div class="line"><a name="l01135"></a><span class="lineno"> 1135</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT gzputs OF((gzFile file, <span class="keyword">const</span> <span class="keywordtype">char</span> *s));</div>
<div class="line"><a name="l01136"></a><span class="lineno"> 1136</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01137"></a><span class="lineno"> 1137</span>&#160;<span class="comment">      Writes the given null-terminated string to the compressed file, excluding</span></div>
<div class="line"><a name="l01138"></a><span class="lineno"> 1138</span>&#160;<span class="comment">   the terminating null character.</span></div>
<div class="line"><a name="l01139"></a><span class="lineno"> 1139</span>&#160;<span class="comment">      gzputs returns the number of characters written, or -1 in case of error.</span></div>
<div class="line"><a name="l01140"></a><span class="lineno"> 1140</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01141"></a><span class="lineno"> 1141</span>&#160; </div>
<div class="line"><a name="l01142"></a><span class="lineno"> 1142</span>&#160;ZEXTERN <span class="keywordtype">char</span> * ZEXPORT gzgets OF((gzFile file, <span class="keywordtype">char</span> *buf, <span class="keywordtype">int</span> len));</div>
<div class="line"><a name="l01143"></a><span class="lineno"> 1143</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01144"></a><span class="lineno"> 1144</span>&#160;<span class="comment">      Reads bytes from the compressed file until len-1 characters are read, or</span></div>
<div class="line"><a name="l01145"></a><span class="lineno"> 1145</span>&#160;<span class="comment">   a newline character is read and transferred to buf, or an end-of-file</span></div>
<div class="line"><a name="l01146"></a><span class="lineno"> 1146</span>&#160;<span class="comment">   condition is encountered.  The string is then terminated with a null</span></div>
<div class="line"><a name="l01147"></a><span class="lineno"> 1147</span>&#160;<span class="comment">   character.</span></div>
<div class="line"><a name="l01148"></a><span class="lineno"> 1148</span>&#160;<span class="comment">      gzgets returns buf, or Z_NULL in case of error.</span></div>
<div class="line"><a name="l01149"></a><span class="lineno"> 1149</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01150"></a><span class="lineno"> 1150</span>&#160; </div>
<div class="line"><a name="l01151"></a><span class="lineno"> 1151</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT    gzputc OF((gzFile file, <span class="keywordtype">int</span> c));</div>
<div class="line"><a name="l01152"></a><span class="lineno"> 1152</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01153"></a><span class="lineno"> 1153</span>&#160;<span class="comment">      Writes c, converted to an unsigned char, into the compressed file.</span></div>
<div class="line"><a name="l01154"></a><span class="lineno"> 1154</span>&#160;<span class="comment">   gzputc returns the value that was written, or -1 in case of error.</span></div>
<div class="line"><a name="l01155"></a><span class="lineno"> 1155</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01156"></a><span class="lineno"> 1156</span>&#160; </div>
<div class="line"><a name="l01157"></a><span class="lineno"> 1157</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT    gzgetc OF((gzFile file));</div>
<div class="line"><a name="l01158"></a><span class="lineno"> 1158</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01159"></a><span class="lineno"> 1159</span>&#160;<span class="comment">      Reads one byte from the compressed file. gzgetc returns this byte</span></div>
<div class="line"><a name="l01160"></a><span class="lineno"> 1160</span>&#160;<span class="comment">   or -1 in case of end of file or error.</span></div>
<div class="line"><a name="l01161"></a><span class="lineno"> 1161</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01162"></a><span class="lineno"> 1162</span>&#160; </div>
<div class="line"><a name="l01163"></a><span class="lineno"> 1163</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT    gzungetc OF((<span class="keywordtype">int</span> c, gzFile file));</div>
<div class="line"><a name="l01164"></a><span class="lineno"> 1164</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01165"></a><span class="lineno"> 1165</span>&#160;<span class="comment">      Push one character back onto the stream to be read again later.</span></div>
<div class="line"><a name="l01166"></a><span class="lineno"> 1166</span>&#160;<span class="comment">   Only one character of push-back is allowed.  gzungetc() returns the</span></div>
<div class="line"><a name="l01167"></a><span class="lineno"> 1167</span>&#160;<span class="comment">   character pushed, or -1 on failure.  gzungetc() will fail if a</span></div>
<div class="line"><a name="l01168"></a><span class="lineno"> 1168</span>&#160;<span class="comment">   character has been pushed but not read yet, or if c is -1. The pushed</span></div>
<div class="line"><a name="l01169"></a><span class="lineno"> 1169</span>&#160;<span class="comment">   character will be discarded if the stream is repositioned with gzseek()</span></div>
<div class="line"><a name="l01170"></a><span class="lineno"> 1170</span>&#160;<span class="comment">   or gzrewind().</span></div>
<div class="line"><a name="l01171"></a><span class="lineno"> 1171</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01172"></a><span class="lineno"> 1172</span>&#160; </div>
<div class="line"><a name="l01173"></a><span class="lineno"> 1173</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT    gzflush OF((gzFile file, <span class="keywordtype">int</span> flush));</div>
<div class="line"><a name="l01174"></a><span class="lineno"> 1174</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01175"></a><span class="lineno"> 1175</span>&#160;<span class="comment">     Flushes all pending output into the compressed file. The parameter</span></div>
<div class="line"><a name="l01176"></a><span class="lineno"> 1176</span>&#160;<span class="comment">   flush is as in the deflate() function. The return value is the zlib</span></div>
<div class="line"><a name="l01177"></a><span class="lineno"> 1177</span>&#160;<span class="comment">   error number (see function gzerror below). gzflush returns Z_OK if</span></div>
<div class="line"><a name="l01178"></a><span class="lineno"> 1178</span>&#160;<span class="comment">   the flush parameter is Z_FINISH and all output could be flushed.</span></div>
<div class="line"><a name="l01179"></a><span class="lineno"> 1179</span>&#160;<span class="comment">     gzflush should be called only when strictly necessary because it can</span></div>
<div class="line"><a name="l01180"></a><span class="lineno"> 1180</span>&#160;<span class="comment">   degrade compression.</span></div>
<div class="line"><a name="l01181"></a><span class="lineno"> 1181</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01182"></a><span class="lineno"> 1182</span>&#160; </div>
<div class="line"><a name="l01183"></a><span class="lineno"> 1183</span>&#160;ZEXTERN z_off_t ZEXPORT    gzseek OF((gzFile file,</div>
<div class="line"><a name="l01184"></a><span class="lineno"> 1184</span>&#160;                                      z_off_t offset, <span class="keywordtype">int</span> whence));</div>
<div class="line"><a name="l01185"></a><span class="lineno"> 1185</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01186"></a><span class="lineno"> 1186</span>&#160;<span class="comment">      Sets the starting position for the next gzread or gzwrite on the</span></div>
<div class="line"><a name="l01187"></a><span class="lineno"> 1187</span>&#160;<span class="comment">   given compressed file. The offset represents a number of bytes in the</span></div>
<div class="line"><a name="l01188"></a><span class="lineno"> 1188</span>&#160;<span class="comment">   uncompressed data stream. The whence parameter is defined as in lseek(2);</span></div>
<div class="line"><a name="l01189"></a><span class="lineno"> 1189</span>&#160;<span class="comment">   the value SEEK_END is not supported.</span></div>
<div class="line"><a name="l01190"></a><span class="lineno"> 1190</span>&#160;<span class="comment">     If the file is opened for reading, this function is emulated but can be</span></div>
<div class="line"><a name="l01191"></a><span class="lineno"> 1191</span>&#160;<span class="comment">   extremely slow. If the file is opened for writing, only forward seeks are</span></div>
<div class="line"><a name="l01192"></a><span class="lineno"> 1192</span>&#160;<span class="comment">   supported; gzseek then compresses a sequence of zeroes up to the new</span></div>
<div class="line"><a name="l01193"></a><span class="lineno"> 1193</span>&#160;<span class="comment">   starting position.</span></div>
<div class="line"><a name="l01194"></a><span class="lineno"> 1194</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l01195"></a><span class="lineno"> 1195</span>&#160;<span class="comment">      gzseek returns the resulting offset location as measured in bytes from</span></div>
<div class="line"><a name="l01196"></a><span class="lineno"> 1196</span>&#160;<span class="comment">   the beginning of the uncompressed stream, or -1 in case of error, in</span></div>
<div class="line"><a name="l01197"></a><span class="lineno"> 1197</span>&#160;<span class="comment">   particular if the file is opened for writing and the new starting position</span></div>
<div class="line"><a name="l01198"></a><span class="lineno"> 1198</span>&#160;<span class="comment">   would be before the current position.</span></div>
<div class="line"><a name="l01199"></a><span class="lineno"> 1199</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01200"></a><span class="lineno"> 1200</span>&#160; </div>
<div class="line"><a name="l01201"></a><span class="lineno"> 1201</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT    gzrewind OF((gzFile file));</div>
<div class="line"><a name="l01202"></a><span class="lineno"> 1202</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01203"></a><span class="lineno"> 1203</span>&#160;<span class="comment">     Rewinds the given file. This function is supported only for reading.</span></div>
<div class="line"><a name="l01204"></a><span class="lineno"> 1204</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l01205"></a><span class="lineno"> 1205</span>&#160;<span class="comment">   gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)</span></div>
<div class="line"><a name="l01206"></a><span class="lineno"> 1206</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01207"></a><span class="lineno"> 1207</span>&#160; </div>
<div class="line"><a name="l01208"></a><span class="lineno"> 1208</span>&#160;ZEXTERN z_off_t ZEXPORT    gztell OF((gzFile file));</div>
<div class="line"><a name="l01209"></a><span class="lineno"> 1209</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01210"></a><span class="lineno"> 1210</span>&#160;<span class="comment">     Returns the starting position for the next gzread or gzwrite on the</span></div>
<div class="line"><a name="l01211"></a><span class="lineno"> 1211</span>&#160;<span class="comment">   given compressed file. This position represents a number of bytes in the</span></div>
<div class="line"><a name="l01212"></a><span class="lineno"> 1212</span>&#160;<span class="comment">   uncompressed data stream.</span></div>
<div class="line"><a name="l01213"></a><span class="lineno"> 1213</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l01214"></a><span class="lineno"> 1214</span>&#160;<span class="comment">   gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)</span></div>
<div class="line"><a name="l01215"></a><span class="lineno"> 1215</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01216"></a><span class="lineno"> 1216</span>&#160; </div>
<div class="line"><a name="l01217"></a><span class="lineno"> 1217</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT gzeof OF((gzFile file));</div>
<div class="line"><a name="l01218"></a><span class="lineno"> 1218</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01219"></a><span class="lineno"> 1219</span>&#160;<span class="comment">     Returns 1 when EOF has previously been detected reading the given</span></div>
<div class="line"><a name="l01220"></a><span class="lineno"> 1220</span>&#160;<span class="comment">   input stream, otherwise zero.</span></div>
<div class="line"><a name="l01221"></a><span class="lineno"> 1221</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01222"></a><span class="lineno"> 1222</span>&#160; </div>
<div class="line"><a name="l01223"></a><span class="lineno"> 1223</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT gzdirect OF((gzFile file));</div>
<div class="line"><a name="l01224"></a><span class="lineno"> 1224</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01225"></a><span class="lineno"> 1225</span>&#160;<span class="comment">     Returns 1 if file is being read directly without decompression, otherwise</span></div>
<div class="line"><a name="l01226"></a><span class="lineno"> 1226</span>&#160;<span class="comment">   zero.</span></div>
<div class="line"><a name="l01227"></a><span class="lineno"> 1227</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01228"></a><span class="lineno"> 1228</span>&#160; </div>
<div class="line"><a name="l01229"></a><span class="lineno"> 1229</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT    gzclose OF((gzFile file));</div>
<div class="line"><a name="l01230"></a><span class="lineno"> 1230</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01231"></a><span class="lineno"> 1231</span>&#160;<span class="comment">     Flushes all pending output if necessary, closes the compressed file</span></div>
<div class="line"><a name="l01232"></a><span class="lineno"> 1232</span>&#160;<span class="comment">   and deallocates all the (de)compression state. The return value is the zlib</span></div>
<div class="line"><a name="l01233"></a><span class="lineno"> 1233</span>&#160;<span class="comment">   error number (see function gzerror below).</span></div>
<div class="line"><a name="l01234"></a><span class="lineno"> 1234</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01235"></a><span class="lineno"> 1235</span>&#160; </div>
<div class="line"><a name="l01236"></a><span class="lineno"> 1236</span>&#160;ZEXTERN <span class="keyword">const</span> <span class="keywordtype">char</span> * ZEXPORT gzerror OF((gzFile file, <span class="keywordtype">int</span> *errnum));</div>
<div class="line"><a name="l01237"></a><span class="lineno"> 1237</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01238"></a><span class="lineno"> 1238</span>&#160;<span class="comment">     Returns the error message for the last error which occurred on the</span></div>
<div class="line"><a name="l01239"></a><span class="lineno"> 1239</span>&#160;<span class="comment">   given compressed file. errnum is set to zlib error number. If an</span></div>
<div class="line"><a name="l01240"></a><span class="lineno"> 1240</span>&#160;<span class="comment">   error occurred in the file system and not in the compression library,</span></div>
<div class="line"><a name="l01241"></a><span class="lineno"> 1241</span>&#160;<span class="comment">   errnum is set to Z_ERRNO and the application may consult errno</span></div>
<div class="line"><a name="l01242"></a><span class="lineno"> 1242</span>&#160;<span class="comment">   to get the exact error code.</span></div>
<div class="line"><a name="l01243"></a><span class="lineno"> 1243</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01244"></a><span class="lineno"> 1244</span>&#160; </div>
<div class="line"><a name="l01245"></a><span class="lineno"> 1245</span>&#160;ZEXTERN <span class="keywordtype">void</span> ZEXPORT gzclearerr OF((gzFile file));</div>
<div class="line"><a name="l01246"></a><span class="lineno"> 1246</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01247"></a><span class="lineno"> 1247</span>&#160;<span class="comment">     Clears the error and end-of-file flags for file. This is analogous to the</span></div>
<div class="line"><a name="l01248"></a><span class="lineno"> 1248</span>&#160;<span class="comment">   clearerr() function in stdio. This is useful for continuing to read a gzip</span></div>
<div class="line"><a name="l01249"></a><span class="lineno"> 1249</span>&#160;<span class="comment">   file that is being written concurrently.</span></div>
<div class="line"><a name="l01250"></a><span class="lineno"> 1250</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01251"></a><span class="lineno"> 1251</span>&#160; </div>
<div class="line"><a name="l01252"></a><span class="lineno"> 1252</span>&#160;                        <span class="comment">/* checksum functions */</span></div>
<div class="line"><a name="l01253"></a><span class="lineno"> 1253</span>&#160; </div>
<div class="line"><a name="l01254"></a><span class="lineno"> 1254</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01255"></a><span class="lineno"> 1255</span>&#160;<span class="comment">     These functions are not related to compression but are exported</span></div>
<div class="line"><a name="l01256"></a><span class="lineno"> 1256</span>&#160;<span class="comment">   anyway because they might be useful in applications using the</span></div>
<div class="line"><a name="l01257"></a><span class="lineno"> 1257</span>&#160;<span class="comment">   compression library.</span></div>
<div class="line"><a name="l01258"></a><span class="lineno"> 1258</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01259"></a><span class="lineno"> 1259</span>&#160; </div>
<div class="line"><a name="l01260"></a><span class="lineno"> 1260</span>&#160;ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, <span class="keyword">const</span> Bytef *buf, uInt len));</div>
<div class="line"><a name="l01261"></a><span class="lineno"> 1261</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01262"></a><span class="lineno"> 1262</span>&#160;<span class="comment">     Update a running Adler-32 checksum with the bytes buf[0..len-1] and</span></div>
<div class="line"><a name="l01263"></a><span class="lineno"> 1263</span>&#160;<span class="comment">   return the updated checksum. If buf is NULL, this function returns</span></div>
<div class="line"><a name="l01264"></a><span class="lineno"> 1264</span>&#160;<span class="comment">   the required initial value for the checksum.</span></div>
<div class="line"><a name="l01265"></a><span class="lineno"> 1265</span>&#160;<span class="comment">   An Adler-32 checksum is almost as reliable as a CRC32 but can be computed</span></div>
<div class="line"><a name="l01266"></a><span class="lineno"> 1266</span>&#160;<span class="comment">   much faster. Usage example:</span></div>
<div class="line"><a name="l01267"></a><span class="lineno"> 1267</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l01268"></a><span class="lineno"> 1268</span>&#160;<span class="comment">     uLong adler = adler32(0L, Z_NULL, 0);</span></div>
<div class="line"><a name="l01269"></a><span class="lineno"> 1269</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l01270"></a><span class="lineno"> 1270</span>&#160;<span class="comment">     while (read_buffer(buffer, length) != EOF) {</span></div>
<div class="line"><a name="l01271"></a><span class="lineno"> 1271</span>&#160;<span class="comment">       adler = adler32(adler, buffer, length);</span></div>
<div class="line"><a name="l01272"></a><span class="lineno"> 1272</span>&#160;<span class="comment">     }</span></div>
<div class="line"><a name="l01273"></a><span class="lineno"> 1273</span>&#160;<span class="comment">     if (adler != original_adler) error();</span></div>
<div class="line"><a name="l01274"></a><span class="lineno"> 1274</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01275"></a><span class="lineno"> 1275</span>&#160; </div>
<div class="line"><a name="l01276"></a><span class="lineno"> 1276</span>&#160;ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,</div>
<div class="line"><a name="l01277"></a><span class="lineno"> 1277</span>&#160;                                          z_off_t len2));</div>
<div class="line"><a name="l01278"></a><span class="lineno"> 1278</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01279"></a><span class="lineno"> 1279</span>&#160;<span class="comment">     Combine two Adler-32 checksums into one.  For two sequences of bytes, seq1</span></div>
<div class="line"><a name="l01280"></a><span class="lineno"> 1280</span>&#160;<span class="comment">   and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for</span></div>
<div class="line"><a name="l01281"></a><span class="lineno"> 1281</span>&#160;<span class="comment">   each, adler1 and adler2.  adler32_combine() returns the Adler-32 checksum of</span></div>
<div class="line"><a name="l01282"></a><span class="lineno"> 1282</span>&#160;<span class="comment">   seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.</span></div>
<div class="line"><a name="l01283"></a><span class="lineno"> 1283</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01284"></a><span class="lineno"> 1284</span>&#160; </div>
<div class="line"><a name="l01285"></a><span class="lineno"> 1285</span>&#160;ZEXTERN uLong ZEXPORT crc32   OF((uLong crc, <span class="keyword">const</span> Bytef *buf, uInt len));</div>
<div class="line"><a name="l01286"></a><span class="lineno"> 1286</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01287"></a><span class="lineno"> 1287</span>&#160;<span class="comment">     Update a running CRC-32 with the bytes buf[0..len-1] and return the</span></div>
<div class="line"><a name="l01288"></a><span class="lineno"> 1288</span>&#160;<span class="comment">   updated CRC-32. If buf is NULL, this function returns the required initial</span></div>
<div class="line"><a name="l01289"></a><span class="lineno"> 1289</span>&#160;<span class="comment">   value for the for the crc. Pre- and post-conditioning (one&#39;s complement) is</span></div>
<div class="line"><a name="l01290"></a><span class="lineno"> 1290</span>&#160;<span class="comment">   performed within this function so it shouldn&#39;t be done by the application.</span></div>
<div class="line"><a name="l01291"></a><span class="lineno"> 1291</span>&#160;<span class="comment">   Usage example:</span></div>
<div class="line"><a name="l01292"></a><span class="lineno"> 1292</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l01293"></a><span class="lineno"> 1293</span>&#160;<span class="comment">     uLong crc = crc32(0L, Z_NULL, 0);</span></div>
<div class="line"><a name="l01294"></a><span class="lineno"> 1294</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l01295"></a><span class="lineno"> 1295</span>&#160;<span class="comment">     while (read_buffer(buffer, length) != EOF) {</span></div>
<div class="line"><a name="l01296"></a><span class="lineno"> 1296</span>&#160;<span class="comment">       crc = crc32(crc, buffer, length);</span></div>
<div class="line"><a name="l01297"></a><span class="lineno"> 1297</span>&#160;<span class="comment">     }</span></div>
<div class="line"><a name="l01298"></a><span class="lineno"> 1298</span>&#160;<span class="comment">     if (crc != original_crc) error();</span></div>
<div class="line"><a name="l01299"></a><span class="lineno"> 1299</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01300"></a><span class="lineno"> 1300</span>&#160; </div>
<div class="line"><a name="l01301"></a><span class="lineno"> 1301</span>&#160;ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));</div>
<div class="line"><a name="l01302"></a><span class="lineno"> 1302</span>&#160; </div>
<div class="line"><a name="l01303"></a><span class="lineno"> 1303</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l01304"></a><span class="lineno"> 1304</span>&#160;<span class="comment">     Combine two CRC-32 check values into one.  For two sequences of bytes,</span></div>
<div class="line"><a name="l01305"></a><span class="lineno"> 1305</span>&#160;<span class="comment">   seq1 and seq2 with lengths len1 and len2, CRC-32 check values were</span></div>
<div class="line"><a name="l01306"></a><span class="lineno"> 1306</span>&#160;<span class="comment">   calculated for each, crc1 and crc2.  crc32_combine() returns the CRC-32</span></div>
<div class="line"><a name="l01307"></a><span class="lineno"> 1307</span>&#160;<span class="comment">   check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and</span></div>
<div class="line"><a name="l01308"></a><span class="lineno"> 1308</span>&#160;<span class="comment">   len2.</span></div>
<div class="line"><a name="l01309"></a><span class="lineno"> 1309</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l01310"></a><span class="lineno"> 1310</span>&#160; </div>
<div class="line"><a name="l01311"></a><span class="lineno"> 1311</span>&#160; </div>
<div class="line"><a name="l01312"></a><span class="lineno"> 1312</span>&#160;                        <span class="comment">/* various hacks, don&#39;t look :) */</span></div>
<div class="line"><a name="l01313"></a><span class="lineno"> 1313</span>&#160; </div>
<div class="line"><a name="l01314"></a><span class="lineno"> 1314</span>&#160;<span class="comment">/* deflateInit and inflateInit are macros to allow checking the zlib version</span></div>
<div class="line"><a name="l01315"></a><span class="lineno"> 1315</span>&#160;<span class="comment"> * and the compiler&#39;s view of z_stream:</span></div>
<div class="line"><a name="l01316"></a><span class="lineno"> 1316</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l01317"></a><span class="lineno"> 1317</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT deflateInit_ OF((z_streamp strm, <span class="keywordtype">int</span> level,</div>
<div class="line"><a name="l01318"></a><span class="lineno"> 1318</span>&#160;                                     <span class="keyword">const</span> <span class="keywordtype">char</span> *version, <span class="keywordtype">int</span> stream_size));</div>
<div class="line"><a name="l01319"></a><span class="lineno"> 1319</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT inflateInit_ OF((z_streamp strm,</div>
<div class="line"><a name="l01320"></a><span class="lineno"> 1320</span>&#160;                                     <span class="keyword">const</span> <span class="keywordtype">char</span> *version, <span class="keywordtype">int</span> stream_size));</div>
<div class="line"><a name="l01321"></a><span class="lineno"> 1321</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT deflateInit2_ OF((z_streamp strm, <span class="keywordtype">int</span>  level, <span class="keywordtype">int</span>  method,</div>
<div class="line"><a name="l01322"></a><span class="lineno"> 1322</span>&#160;                                      <span class="keywordtype">int</span> windowBits, <span class="keywordtype">int</span> memLevel,</div>
<div class="line"><a name="l01323"></a><span class="lineno"> 1323</span>&#160;                                      <span class="keywordtype">int</span> strategy, <span class="keyword">const</span> <span class="keywordtype">char</span> *version,</div>
<div class="line"><a name="l01324"></a><span class="lineno"> 1324</span>&#160;                                      <span class="keywordtype">int</span> stream_size));</div>
<div class="line"><a name="l01325"></a><span class="lineno"> 1325</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT inflateInit2_ OF((z_streamp strm, <span class="keywordtype">int</span>  windowBits,</div>
<div class="line"><a name="l01326"></a><span class="lineno"> 1326</span>&#160;                                      <span class="keyword">const</span> <span class="keywordtype">char</span> *version, <span class="keywordtype">int</span> stream_size));</div>
<div class="line"><a name="l01327"></a><span class="lineno"> 1327</span>&#160;ZEXTERN <span class="keywordtype">int</span> ZEXPORT inflateBackInit_ OF((z_streamp strm, <span class="keywordtype">int</span> windowBits,</div>
<div class="line"><a name="l01328"></a><span class="lineno"> 1328</span>&#160;                                         <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> FAR *window,</div>
<div class="line"><a name="l01329"></a><span class="lineno"> 1329</span>&#160;                                         <span class="keyword">const</span> <span class="keywordtype">char</span> *version,</div>
<div class="line"><a name="l01330"></a><span class="lineno"> 1330</span>&#160;                                         <span class="keywordtype">int</span> stream_size));</div>
<div class="line"><a name="l01331"></a><span class="lineno"> 1331</span>&#160;<span class="preprocessor">#define deflateInit(strm, level) \</span></div>
<div class="line"><a name="l01332"></a><span class="lineno"> 1332</span>&#160;<span class="preprocessor">        deflateInit_((strm), (level),       ZLIB_VERSION, sizeof(z_stream))</span></div>
<div class="line"><a name="l01333"></a><span class="lineno"> 1333</span>&#160;<span class="preprocessor">#define inflateInit(strm) \</span></div>
<div class="line"><a name="l01334"></a><span class="lineno"> 1334</span>&#160;<span class="preprocessor">        inflateInit_((strm),                ZLIB_VERSION, sizeof(z_stream))</span></div>
<div class="line"><a name="l01335"></a><span class="lineno"> 1335</span>&#160;<span class="preprocessor">#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \</span></div>
<div class="line"><a name="l01336"></a><span class="lineno"> 1336</span>&#160;<span class="preprocessor">        deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\</span></div>
<div class="line"><a name="l01337"></a><span class="lineno"> 1337</span>&#160;<span class="preprocessor">                      (strategy),           ZLIB_VERSION, sizeof(z_stream))</span></div>
<div class="line"><a name="l01338"></a><span class="lineno"> 1338</span>&#160;<span class="preprocessor">#define inflateInit2(strm, windowBits) \</span></div>
<div class="line"><a name="l01339"></a><span class="lineno"> 1339</span>&#160;<span class="preprocessor">        inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))</span></div>
<div class="line"><a name="l01340"></a><span class="lineno"> 1340</span>&#160;<span class="preprocessor">#define inflateBackInit(strm, windowBits, window) \</span></div>
<div class="line"><a name="l01341"></a><span class="lineno"> 1341</span>&#160;<span class="preprocessor">        inflateBackInit_((strm), (windowBits), (window), \</span></div>
<div class="line"><a name="l01342"></a><span class="lineno"> 1342</span>&#160;<span class="preprocessor">        ZLIB_VERSION, sizeof(z_stream))</span></div>
<div class="line"><a name="l01343"></a><span class="lineno"> 1343</span>&#160; </div>
<div class="line"><a name="l01344"></a><span class="lineno"> 1344</span>&#160; </div>
<div class="line"><a name="l01345"></a><span class="lineno"> 1345</span>&#160;<span class="preprocessor">#if !defined(ZUTIL_H) &amp;&amp; !defined(NO_DUMMY_DECL)</span></div>
<div class="line"><a name="l01346"></a><span class="lineno"> 1346</span>&#160;    <span class="keyword">struct </span><a class="code" href="structinternal__state.html">internal_state</a> {<span class="keywordtype">int</span> dummy;}; <span class="comment">/* hack for buggy compilers */</span></div>
<div class="line"><a name="l01347"></a><span class="lineno"> 1347</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l01348"></a><span class="lineno"> 1348</span>&#160; </div>
<div class="line"><a name="l01349"></a><span class="lineno"> 1349</span>&#160;ZEXTERN <span class="keyword">const</span> <span class="keywordtype">char</span>   * ZEXPORT zError           OF((<span class="keywordtype">int</span>));</div>
<div class="line"><a name="l01350"></a><span class="lineno"> 1350</span>&#160;ZEXTERN <span class="keywordtype">int</span>            ZEXPORT inflateSyncPoint OF((z_streamp z));</div>
<div class="line"><a name="l01351"></a><span class="lineno"> 1351</span>&#160;ZEXTERN <span class="keyword">const</span> uLongf * ZEXPORT get_crc_table    OF((<span class="keywordtype">void</span>));</div>
<div class="line"><a name="l01352"></a><span class="lineno"> 1352</span>&#160; </div>
<div class="line"><a name="l01353"></a><span class="lineno"> 1353</span>&#160;<span class="preprocessor">#ifdef __cplusplus</span></div>
<div class="line"><a name="l01354"></a><span class="lineno"> 1354</span>&#160;}</div>
<div class="line"><a name="l01355"></a><span class="lineno"> 1355</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l01356"></a><span class="lineno"> 1356</span>&#160; </div>
<div class="line"><a name="l01357"></a><span class="lineno"> 1357</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* ZLIB_H */</span><span class="preprocessor"></span></div>
<div class="ttc" id="astructgz__header__s_html"><div class="ttname"><a href="structgz__header__s.html">gz_header_s</a></div><div class="ttdef"><b>Definition:</b> zlib.h:109</div></div>
<div class="ttc" id="astructinternal__state_html"><div class="ttname"><a href="structinternal__state.html">internal_state</a></div><div class="ttdef"><b>Definition:</b> deflate.h:94</div></div>
<div class="ttc" id="astructz__stream__s_html"><div class="ttname"><a href="structz__stream__s.html">z_stream_s</a></div><div class="ttdef"><b>Definition:</b> zlib.h:82</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_3eca864c65823895cb378d0a822acbce.html">surface</a></li><li class="navelem"><a class="el" href="dir_3f3c04b1471cb7c6ed159d82d5dbd2e2.html">include</a></li><li class="navelem"><a class="el" href="dir_c085629c2ec3cefd048e595d13476517.html">pcl</a></li><li class="navelem"><a class="el" href="dir_b042217bdec4068b97400d7bbc365877.html">surface</a></li><li class="navelem"><a class="el" href="dir_f289cf8a53139bf575d4708d4be18702.html">3rdparty</a></li><li class="navelem"><a class="el" href="dir_3e104991de59e163b14eb89d81d44a83.html">opennurbs</a></li><li class="navelem"><b>zlib.h</b></li>
    <li class="footer">制作者 <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
  </ul>
</div>
</body>
</html>
